I'm building a tool which renders text on a low-resolution image (it targets a low-resolution sign).
We're using Magick.NET, so rendering text is quite easy:
using ImageMagick;
MagickImage image = new MagickImage(MagickColors.White, 80, 96);
image.Settings.AntiAlias = false;
image.Settings.StrokeAntiAlias = false;
image.Settings.TextAntiAlias = false;
image.Format = MagickFormat.Png;
var drawables = new Drawables()
.FillColor(MagickColors.Black)
.Font("Arial")
.FontPointSize(14);
drawables.Text(0, 25, "dddDDDddDDWwwWW");
image.Draw(drawables);
image.Write(@"test.png");
But the rendering isn't good - it returns different images for the same letter. Given this example:
As you can see, 'd' is rendered differently on multiple occasions. How can I improve this?
You may try to use monospaced font. E.g. in Windows there are builtin 'Consolas' and 'Courier New' monospaced fonts:
Enabling text antialiasing by
TextAntialias(true)
should smooth the text: