What is a color space?¶
A color space defines a subset of colors (a volume in a 3D color diagram, or a surface on a 2D projection like the CIE xy) drawn from the visible spectrum (or even outside the visible spectrum)1.
Note
A color space describes the colors as they should be reproduced, but doesn’t define the technical means of recording them in files. See chapter Pixel Format about this subject.
What defines a color space¶
The set of colors which can be be represented by a color space depends on a main parameter: The primary colors of the color space.
The way of representing these colors depends on two other parameters which supplement the definition of a color space: The white point and the transfer curve.
Primaries and gamut¶
Most often being 3, the primary colors are the paramount values of the color space; they can be represented by precise coordinates in the CIE XYZ space (which is a representation of all visible colors on three axes). They’re in the majority of cases a shade of Red, Green and Blue, and are ideally close as possible to a real monochromatic color (the external edge of the CIE xy diagram).
Each space defines its primary colors by at least three coordinates in the CIE XYZ space.
For example, here are the coordinates of the Red, Green and Blue in the sRGB (standard Red, Green, Blue) space:
R | G | B | |
---|---|---|---|
X | 0,64 | 0,30 | 0,15 |
Y | 0,33 | 0,60 | 0,06 |
Z | 0,03 | 0,1 | 0,79 |
This means that for two given spaces, the most intense “Red” value isn’t concretely reproduced by the same shade: some spaces will have a more or less intense or saturated primary red (more or less close to monochromatic waves), more or less orange, for example.
The color space consequently defines the way in which the most intense value of a primary color must be reproduced by the physical device which will display it (the screen, the projector, or the printer, etc).
In other words, each reproduction device must be able to precisely control which light rays, at which wavelengths, which physical colors, it’s able to produce. According to the range of these wavelengths, the device is compatible with various color spaces if it’s able to produce the wavelengths necessary to the reproduction of the primaries of the space.
The coordinates of the primary colors define the limits of a subspace including all colors included in the color space. This subspace is more or less large (it allows to represent more or less different colors); the size of this space is what’s called the gamut.
White point¶
We have seen that in human perception, what’s regarded as white varies enormously according to the conditions of the environment in which we perceive the colors. It is therefore necessary to define in the color space the color which will be regarded as white, corresponding concretely to that which must be obtained by blending in equal proportion the various primary colors (white if using the maximum intensity, gray with lower intensities).
This white point is also given by its coordinates in the CIE XYZ space.
For example, here are the coordinates of the white point in the sRGB space:
White | |
---|---|
x | 0,3127 |
y | 0,3290 |
The CIE has defined a number of remarkable white points (also called illuminants), useful for specific purposes. They’re represented by letters (from A to F), sometimes accompanied by a number in case of series of white points.
A few examples:
- The A illuminant represents the color emitted by a tungsten filament of the old domestic bulb; in other words the color of a 2856 Kelvin black body (cf. Color temperature).
- The B illuminant represents direct sunlight.
- The D series of illuminants represent daylight in different conditions (e.g. D65 represents light under a cloudy sky).
The D65 illuminant is the one most commonly used as a white point in various color spaces.
Note
The white point is sometimes itself, by simplification, considered as a primary color (in the sense that it’s also simply a precise color, a coordinate in the CIE XYZ). In this case the primaries of the space are at least 4 and the space is only defined by two parameters.
The color space normally also associates with a given white point its maximum intensity, its luminance, most often measured in candela per square meter, cd/m².
The transfer curve¶
Colors in a color space are given by the intensity of each primary, represented by a value ranging from 0.0
to 1.0
.
The 0.0
value represents a null intensity (the absence of light, a perfect black) and the 1.0
value represents the color given by the coordinate of the primary in the CIE XYZ.
The question arises as to how the intermediate values are translated into real colors (or coordinates in the CIE XYZ). This translation is done by a transfer curve. It’s a “simple” mathematical function which, for a given value in the color space, gives the corresponding coordinate in the CIE XYZ.
The space is said linear when this curve is a simple affine function, i.e. represented by a straight line, and whose correspondence between the values is just proportional.
Other spaces use a more complex transfer curve to better reflect human vision and/or the way early CRTs reproduced intensities2 (with a 2.4 gamma); the “simplest” of these curves are the so-called gamma curves. This being said, most spaces do not use simple gamma curves but more complex ones.
See the section entitled L - Transfer curves, linear space and gamma for more details.
Other parameters¶
The color spaces can also impose or recommend other parameters, especially on the way of encoding/storing colors, according to their intended uses.
Pixel format¶
For storing pixels, spaces can recommend different formats. The two most common are:
- RGB, where the pixel contains three values: red, green and blue.
- YUV, where the pixel contains one value of luminance and two of chrominance.
See section RGB and YUV for more details.
Depth¶
Color spaces may specify a specific number of bits to be used for each pixel to encode each color. For example sRGB specifies a minimum of 8 bits, and Rec.2020 specifies 10 or 12 bits.
See section Depth (bpc) for more details.
Why different color spaces?¶
There are a lot of different color spaces. There’re in fact as many as different uses of colors, plus the fact that the device manufacturers and software designers add their own spaces to this already long list. The uses are relatively unstandardized.
Certain spaces are therefore related to precise capture devices: a camera can record the data which it captures in a space which is specific to it, and corresponds to the capacities of its sensor, or to the use which will be made of the images (for example by proposing a broad range of colors which facilitates post-production).
Other spaces are linked to reproduction devices (screens, projectors, printers…) and represent the colors that the equipment is capable of reproducing.
Finally, more recently, spaces were created specifically for image work; they are then used temporarily and are different from the spaces used to capture, record or reproduce the images.
It’s thus necessary to keep in mind that several color spaces come into play when working on an image:
- The color space of the imported and used media.
- The color space used for the display.
- The working color space, used to make the calculations on the image, by the computer.
- The color space used to record and store the output data (and later when displaying the media).
These spaces are classified into two categories:
- Display-referred or Output-referred: Spaces used for display and reproduction.
- Scene-referred: Spaces used for computation.
Not all of these spaces are necessarily the same (and are rarely the same in reality), each having a specific use and corresponding to specific needs; a certain number of conversions then come into play to pass from one space to another. This is where the ability to convert information to and from a reference space (the CIE XYZ) allows one to work safely with multiple spaces, with each space defining its primary, white point and transfer curve relative to the same reference space.
Warning
It’s a common mistake to think that you have to work in the space used for output (output-referred) when the output-referred spaces were intended for display, not computation. The scene-referred spaces are intended for work.
Sources & References
-
It doesn’t define a number of colors, of different shades (which depends on the sampling, on the way the values are digitally stored), but a limited range of colors in the set of real colors; in other words, it defines the size of a set of colors, but not the number of subdvisions of the set, which can be more or less fine in its concrete implementation. See the section Pixel format for more details. ↩
-
The transfer curves during the analog era represented in fact the correspondence between the intensity of the electric signal, and the luminosity captured or reproduced by the camera or the screen; the modern gamma* follows the same rules to link the luminous intensity to the digital value ↩