I have the function below to generate a sample logo. What I want to do is to return a transparent png or gif instead of a white background.
How can I do that?
You can do something like this:
Bitmap bmp = new Bitmap(300, 300); Graphics g = Graphics.FromImage(bmp); g.Clear(Color.Transparent); g.FillRectangle(Brushes.Red, 100, 100, 100, 100); g.Flush(); bmp.Save("test.png", System.Drawing.Imaging.ImageFormat.Png);