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?
Take a look at Can you make an alpha transparent PNG with C#?
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);