Color to Grayscale Conversion

This online calculator converts color image to grayscale image using the luminosity method

Esta página existe graças aos esforços das seguintes pessoas:

Timur

Timur

Criado: 2021-05-22 12:44:03, Ultima atualização: 2021-07-04 05:54:20

This calculator converts the colors of the loaded image to grayscale. By default, the standard weights for red (0.2126), green (0.7152), and blue (0.0722) are used, but you can specify your own coefficients. You can read more about the conversion below the calculator.

PLANETCALC, Color to Grayscale Conversion

Color to Grayscale Conversion

Source image
  • Drag files here
Source image
 
Grayscale image
 

Conversion of a color image to a grayscale image

To convert a color image to a grayscale image in the RGB model you need to replace different red, green, and blue values for a given pixel with a single value that characterizes the brightness or luminosity of the pixel. The standard RGB model allocates 1 byte for each color, respectively, after the conversion, the pixel can have only on of the [0,0,0], [1,1,1], [2,2,2] ... [255,255,255] values, where [0,0,0] is black and [255,255,255] is white. A color image is thus represented by 256 shades of gray.

Since colors with different wavelengths are perceived differently by the human eye, different weights are assigned to different colors to calculate the luminosity of a point. The human eye is most sensitive to green, so the largest weight is used for green - 0.7152, the least sensitive to blue, with a weight of 0.0722, and red uses a weight of 0.2126. These coefficients are written in the sRGB standard - this is how the luminosity of color is calculated when switching from sRGB to the CIE XYZ color space.

Thus, the formula for calculating the new values ​​of R, G and B (all three are the same) from the existing values is as follows:
Y = 0.2126R + 0.7152G + 0.0722B

These values ​​can be changed in the calculator above. For example, you can enter the same weight for all three colors - 0.33 and look at the result

URL copiado para a área de transferência
PLANETCALC, Color to Grayscale Conversion

Comentários