开发者

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

开发者 https://www.devze.com 2022-12-16 10:14 出处:网络
I need to convert all the ima开发者_运维问答ges in a folder to greyscale (I believe their gif files if that matters).Any suggestions?I have .NET 3.5 (sp1)Maybe you can do like this guy.

I need to convert all the ima开发者_运维问答ges in a folder to greyscale (I believe their gif files if that matters). Any suggestions? I have .NET 3.5 (sp1)


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号