Remove Image Color? RRS feed

  • Question

  • User1059596723 posted
    Is it possible to remove the color from a Bitmap? Let's say I have this: Bitmap bmp = new Bitmap("someimgpath"); //this image has color Bitmap blackandwhite = bmp.Clone(new Rectangle(0,0,bmp.Width, bmp.Height), PixelFormat.Format16bppGrayScale); And of course that results in an overflow, it is trying to clone 32 bits of color into 16, which of course will not work. How can I get rid of the color, or change the palette?
    Wednesday, February 2, 2005 12:42 PM

All replies

  • User88235362 posted
    I'm not sure if this is completly relevant for the question asked, but it might be a good starting point for you... http://www.codeproject.com/useritems/colorwash.asp The article's concerned with manipulating the individual pixels of an image to alter it's color - you might be able to adapt the code to produce a grayscale effect. If you're only targetting IE browsers then IE actually has some extended CSS functionality that allows you to show images in grayscale. A quick search turned up this article that may be relevant if this is the case http://www.netspade.com/articles/css/filters.xml - there's more articles out there though that show you the effect of various filters if you search around.
    Saturday, March 5, 2005 8:49 AM