Grayscale
This article needs additional citations for verification. (March 2023) |
Color depth |
---|
Related |
In
Grayscale images are distinct from one-bit bi-tonal black-and-white images, which, in the context of computer imaging, are images with only two colors: black and white (also called bilevel or binary images). Grayscale images have many shades of gray in between.
Grayscale images can be the result of measuring the intensity of light at each pixel according to a particular weighted combination of frequencies (or wavelengths), and in such cases they are
A
If the original color image has no defined colorspace, or if the grayscale image is not intended to have the same human-perceived achromatic intensity as the color image, then there is no unique mapping from such a color image to a grayscale image.
Numerical representations
The intensity of a pixel is expressed within a given range between a minimum and a maximum, inclusive. This range is represented in an abstract way as a range from 0 (or 0%) (total absence, black) and 1 (or 100%) (total presence, white), with any fractional values in between. This notation is used in academic papers, but this does not define what "black" or "white" is in terms of
In computing, although the grayscale can be computed through
Technical uses (e.g. in
Converting color to grayscale
Conversion of an arbitrary color image to grayscale is not unique in general; different weighting of the color channels effectively represent the effect of shooting black-and-white film with different-colored photographic filters on the cameras.
Colorimetric (perceptual luminance-preserving) conversion to grayscale
A common strategy is to use the principles of
To convert a color from a colorspace based on a typical
For the common sRGB color space, gamma expansion is defined as
where Csrgb represents any of the three gamma-compressed sRGB primaries (Rsrgb, Gsrgb, and Bsrgb, each in range [0,1]) and Clinear is the corresponding linear-intensity value (Rlinear, Glinear, and Blinear, also in range [0,1]). Then, linear luminance is calculated as a weighted sum of the three linear-intensity values. The sRGB color space is defined in terms of the CIE 1931 linear luminance Ylinear, which is given by[6]
These three particular coefficients represent the intensity (luminance) perception of typical
Because the three sRGB components are then equal, indicating that it is actually a gray image (not color), it is only necessary to store these values once, and we call this the resulting grayscale image. This is how it will normally be stored in sRGB-compatible image formats that support a single-channel grayscale representation, such as JPEG or PNG. Web browsers and other software that recognizes sRGB images should produce the same rendering for such a grayscale image as it would for a "color" sRGB image having the same values in all three color channels.
Luma coding in video systems
For images in color spaces such as
luma (Y′) component is computed asNormally these colorspaces are transformed back to nonlinear R'G'B' before rendering for viewing. To the extent that enough precision remains, they can then be rendered accurately.
But if the luma component Y' itself is instead used directly as a grayscale representation of the color image, luminance is not preserved: two colors can have the same luma Y′ but different CIE linear luminance Y (and thus different nonlinear Ysrgb as defined above) and therefore appear darker or lighter to a typical human than the original color. Similarly, two colors having the same luminance Y (and thus the same Ysrgb) will in general have different luma by either of the Y′ luma definitions above.[8]
Grayscale as single channels of multichannel color images
Color images are often built of several stacked
Here is an example of color channel splitting of a full RGB color image. The column at left shows the isolated color channels in natural colors, while at right there are their grayscale equivalences:
The reverse is also possible: to build a full-color image from their separate grayscale channels. By mangling channels, using offsets, rotating and other manipulations, artistic effects can be achieved instead of accurately reproducing the original image.
See also
- Channel (digital image)
- Halftone
- Duotone
- False-color
- Sepia tone
- Cyanotype
- Morphological image processing
- Mezzotint
- List of monochrome and RGB color formats – Monochrome palettes section
- List of software palettes – Color gradient palettes and false color palettes sections
- Achromatopsia, total color blindness, in which vision is limited to a grayscale
- Zone System
References
- ISBN 0-596-52370-X.
- ISBN 978-0-12-391926-7. Retrieved 2022-03-31.
- (PDF) from the original on 2023-04-23.
- ^ Poynton, Charles A. (2004-02-25). "Constant Luminance". Video Engineering. Archived from the original on 2023-03-16.
- ^ Lindbloom, Bruce (2017-04-06). "RGB Working Space Information". Archived from the original on 2023-06-01.
- ^ Stokes, Michael; Anderson, Matthew; Chandrasekar, Srinivasan; Motta, Ricardo (1996-11-05). "A Standard Default Color Space for the Internet – sRGB". World Wide Web Consortium – Graphics on the Web. Part 2, matrix in equation 1.8. Archived from the original on 2023-05-24.
- ISBN 978-1-84800-195-4.
- ^ Poynton, Charles A. (1997-07-15). "The Magnitude of Nonconstant Luminance Errors" (PDF).