Ralph Shillington
Ralph Shillington

Reputation: 21108

Is there an easy way to convert an image to grayscale with .NET

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)

Upvotes: 2

Views: 218

Answers (2)

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 121067

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

Upvotes: 3

ChrisF
ChrisF

Reputation: 137198

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.

Upvotes: 0

Related Questions