How to convert a color image into a black and white image

xiaoxiao2021-03-06  95

When the color image is converted into black and white images, it is necessary to calculate the effective brightness value of each pixel in the image, by matching pixels.

The brightness value can be easily converted to black and white images.

Calculate the pixel effective brightness value can use the following formula:

Y = 0.3red 0.59Green 0.11Blue

Then use the color.fromargb (y, y, y) to convert the calculated value.

Conversion code can be implemented using the following method:

[C #]

public

Bitmap ConvertTograscale (Bitmap Source)

{Bitmap BM = New Bitmap (Source.width, Source.Height); for (int y = 0; y

转载请注明原文地址:https://www.9cbs.com/read-100002.html

New Post(0)