This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/9279/. Also, please do not modify any references to the original work (if any) contained in this content.
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.
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:
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