1
I have the following code:
FileStream fs = new FileStream(@"\path\imagem1.png", FileMode.Open, FileAccess.Read);
Image image = Image.FromStream(fs);
fs.Close();
Bitmap b = new Bitmap(image);
Graphics graphics = Graphics.FromImage(b);
graphics.DrawString("Meu texto", new Font("Arial", 50), Brushes.White, 0, 0);
b.Save(@"\path\resultado.png", image.RawFormat);
image.Dispose();
b.Dispose();
Yeah, there’s a picture there! But it not only has no background color, it also has a great level of transparency.
The problem is that I would like to put a background to it, so the result would be:
I tried to draw a red rectangle, but it superimposes the image.