sRGB specifies a red-green-blue colour encoding. Restricting attention to component values in , its encoded component corresponds to the linear-light componentThus the conversion is piecewise, not a single power law. The reverse conversion used here isThese conventional rounded thresholds are used by the W3C conversion routines; they give a tiny mismatch at the join rather than a mathematically exact pair of inverses everywhere.[ref]
https://www.w3.org/TR/css-color-4/#predefined-sRGB. W3C, CSS Color Module Level 4, section 10.2: encoded and linear-light sRGB
[ref]https://www.w3.org/TR/css-color-4/#color-conversion-code. W3C, CSS Color Module Level 4, sample colour-conversion code: lin_sRGB and gam_sRGB
For an eight-bit neutral grayscale code , use in all three components. Its relative luminance is then . For example, , whereas . This is why averaging encoded values and averaging linear light give different answers. sRGB is a specified interpretation; merely calling a raster image grayscale does not imply it uses sRGB.
For the normalized sRGB calculations here, relative luminance is the linear-light weighted sumwhere are decoded linear-light components, not encoded code values. This is the sRGB calculation specified in W3C's WCAG 2.2 definition of relative luminance. It places reference black at 0 and reference white at 1; it does not by itself specify an absolute display light level.[ref]
https://www.w3.org/TR/WCAG22/#dfn-relative-luminance. W3C, WCAG 2.2, definition of relative luminance: sRGB decoding and weights
For a neutral sRGB shade, , and the weights sum to 1, so . For a coloured pixel, relative luminance can be encoded as a neutral sRGB shade with all three encoded components . This preserves the specified while discarding colour differences; it is one precisely defined grayscale conversion, not a unique way to turn all colour images into grayscale.
Articles by others on the same topic
There are currently no matching articles.