Skip to content

DrawText over a BMP 128x64 displays deformed text #134

@josellm

Description

@josellm

Description

I need to send a text to a 128x64 LCD display. I need to generate a bmp and draw some text over. I first use System.Drawing but due to problems with windows nano container I migrate the code to SixLabors.ImageSharp.

The resulting text with SixLabors.ImageSharp don't display smoothly like System.Drawing

Removing HorizontalAlignment and VerticalAlignment helps but it still doesn't show it correctly.

At left the version using System.Drawing, at the right using SixLabors.ImageSharp

2021-05-12 15-06-36

Steps to Reproduce

using (var img = new Image<Rgb24>(128, 64, Color.White)) {
	img.Mutate(x => x.DrawText(new TextGraphicsOptions() {
		TextOptions = new TextOptions() {
			HorizontalAlignment = HorizontalAlignment.Center,
			VerticalAlignment = VerticalAlignment.Center,
			WrapTextWidth = img.Width,
			ApplyKerning = true,
			DpiX = 100,
			DpiY = 100,
		},
		GraphicsOptions = new GraphicsOptions {
			Antialias = false,
			ColorBlendingMode = PixelColorBlendingMode.Normal
		}
	}, "Lorem ipsum dolor sit amet", SystemFonts.CreateFont("Tahoma", 8, FontStyle.Regular), Color.Black, new Point(0, 31)));
	img.SaveAsPng(filepath);
}

System Configuration

  • ImageSharp.Drawing version:
    SixLabors.ImageSharp Version=1.0.3
    SixLabors.Fonts Version=1.0.0-beta0013
    SixLabors.ImageSharp.Drawing Version=1.0.0-beta11

  • Other ImageSharp packages and versions: I tested with packages from MyGet with the same result
    SixLabors.Fonts Version=1.0.0-beta13.5.1
    SixLabors.ImageSharp Version=1.0.3
    SixLabors.ImageSharp.Drawing Version=1.0.0-beta11.8

  • Environment: Windows 10 & Windows Nano Server

  • .NET Framework version: .Net 5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions