How to make a color transparent? - need help

J

Josch

I have here a specific problem with ASP.NET in C#. I want to convert an Icon
(System.Drawing.Icon icon) to a GIF-Image.

First, my attempt was converting the icon to a Bitmap:

Bitmap bmp = icon.ToBitmap();

Then save this Bitmap as a GIF-Image:

bmp.Save("mypic.gif",ImageFormat.Gif);

OK, this works but when I load the new GIF-Image into my Browser, the
defined transparent color is black.

My second attempt was to define the color in the Bitmap manually as
transparent.

Bitmap bmp = icon.ToBitmap();
bmp.MakeTransparent(bmp.GetPixel(0,0));
bmp.Save("mypic.gif",ImageFormat.Gif);

So I was in big hope, but this also doesn't work. Has anybody an idea, how i
can manage this?

Thanks a lot!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top