C# Win7 and Win2019 Convert text to image gives blur, not clear

Viewed 77

I have a C# programm, that convert Text to Image by using GDI+ method Graphics.DrawString

On my machine with Windows 7 it works good

see example image here:

enter image description here

enter image description here

But on the Windows Server 2019 it creates blurry, not clear image

see example image here:

enter image description here

enter image description here

I even tried to use GDI method TextRenderer.DrawText

but it gave same blur (see links above)

I tried to install .NET Framework 4.8, all Visual C++ Redistributables but had no sucess

1 Answers

Thanks to comment of Selvin, I found the solution

on GDI TextRenderer.DrawText

graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

on GDI+ Graphics.DrawString

graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
Related