views:

49

answers:

2

I need to convert all the images in a folder to greyscale (I believe their gif files if that matters). Any suggestions? I have .NET 3.5 (sp1)

+3  A: 

Maybe you can do like this guy. Or maybe like so

klausbyskov
Use the second one...you do need to use weighted values for the colors rather than an even average... the human eye does not take in all colors equally.
monksy
Erm, they are the same.
Hans Passant
@nobugz they are not the same. The second example shows two different ways to do it.
klausbyskov
They both use the ordinary 0.3/0.59/0.11-rule to transform RGB into luminance/intensity.
kigurai
A: 

There are different approaches:

  1. Average the red, green and blue values. Simple, but the result probably won't look right unless you weight the values first.

  2. Convert the image to Hue, Lightness and Saturation values and take the lightness.

You can read images using the Image class. There's a method to read the image from file.

ChrisF