locked
Bitmap.MakeTransparent RRS feed

  • Question

  • User541108374 posted
    Hi, I'm struggling with some code: Dim ico As New Icon("c:\copy.ico") Dim bmp As Bitmap() bmp = ico.ToBitmap bmp.MakeTransparent(bmp.GetPixel(0, 15)) bmp.Save("c:\copy.gif", Imaging.ImageFormat.Gif) the copy.ico is the standard icon from office with on the lower left (in vs.net) the color rgb: 0 128 128. I'm trying to set this color as transparent before converting it to a gif image. Unfortunately it always turns out to be a black backgroundcolor instead of transparent. When I leave the Imaging.ImageFormat.Gif the image has a color of grey (still not transparent) and it can't be opened with photoshop (it opens when I put the ImageFormat back to gif). Does anyone have any experience with solving this problem? Thx, Kris.
    Monday, March 1, 2004 2:29 PM

All replies

  • User-1372641848 posted
    There is no method available directly in GDI + to save transterent gif images but there are some work around.(though not elegant) you will have to create your own ColorPellate(can not create pellate directly so create image and grab pellate) check your image for colors and add those colors to pallete. see code below it will give some idea how you can solve your problem. http://aspalliance.com/cookbook/ViewSource.aspx?Filename=recipe2216cs.aspx&RecipeType=ASPX
    Monday, March 1, 2004 8:48 PM