Reputation: 1877
I'm creating a console app that will generate a image with text in it. I'm using the following code:
Bitmap bmp = new Bitmap(400, 50);
Graphics g = Graphics.FromImage(bmp);
Font f = new Font("Arial", 12, FontStyle.Regular);
g.DrawString("My text", f, Brushes.Black, 10, 10);
But the result is always the following image, regardless of what font family i use instead of Arial.
Upvotes: 0
Views: 139
Reputation: 14251
The newly created bitmap has a transparent background. Because of this, anti-aliasing, smoothing, and similar functions do not work when drawing text.
Fill the graphics with some color
g.Clear(Color.White);
Upvotes: 1