RGB color space

from Wikipedia, the free encyclopedia

An RGB color space is an additive color space that reproduces color perception through the additive mixing of three basic colors ( red, green and blue ). The color vision of man is characterized by three types of cones. This color space is based in principle on the three-color theory .


The RGB color space can be represented as a linear space, clearly as a color cube.

After initial investigations and reflections on the phenomenon of “color vision” in the 18th century, it was primarily scientific research in the 19th century that led to the first quantitative theories. One of them is the three-color theory . After that, almost all color stimuli can be reproduced by mixing three primary colors . The light spectrum composed of the three primary color stimuli can differ greatly from the spectrum of the original stimulus without the human eye noticing a difference: the two color stimuli are metameric . If the two color stimuli cannot be differentiated, it is not necessary to save the exact spectral distribution for a reconstruction of the color tones. In order to reproduce this color stimulus, it is sufficient to save a triplet of numbers that describes the amount of red, green and blue light. This is exactly how a color is described in RGB space. If a red, a green and a blue are defined in maximum intensity, the red component R, the green component G and the blue component B can describe the color: Color =  (R, G, B)

The value ranges for the color stimuli (R, G, B) can be defined differently. The classic representation allows values ​​between 0 and 1 (i.e. 0 percent and 100 percent). This is based on the practical classic implementation using damping of existing light. Computer-oriented applications often use the notation based on the classic form of storage, integers between 0 and a maximum number such as 255 are stored.

Adobe RGB (1998) color space in the CIE standard color table (color representation for orientation): The Adobe RGB (1998) color space only includes the colors within the triangle drawn and does not contain a considerable proportion of perceptible colors.

Since human intensity perception is non-linear according to the Weber-Fechner rule , a non-linear coding is usually carried out for the luminance. This is often referred to as the gamma function, since the first implementations used the power function Y ~ L 1 / γ as an approach. The coefficient gamma with γ> 1 describes the curvature of the curve. The inverse function is L ~ Y  γ .

In addition to this non-linear coding , the coordinate system has a total of 9 degrees of freedom that are to be defined for a specific RGB space. The information can be given in different ways, which can lead to confusion for the user. There are different options for all three primary valences

  • by means of the standard color table (x, y) with the addition of the white point as reference brightness
  • by means of the matrix (Y, x, y) with the standard color value components x and y and the standard color value Y, which is used here as a measure of the brightness
  • using the matrix (X, Y, Z) and thus all three standard color values ​​X, Y, Z, based on the spectral value functions established by the CIE in 1931.

Instead of 8-bit unsigned integers, modern computer-oriented applications and interfaces often use floating point numbers, at least internally, which break out of the interval [0.255] and can thus represent larger value ranges with a higher resolution. This means that there is no limitation to a maximum brightness.

The colored field of the XYZ space stands for the amount of all visible colors. The CIE standard valence system is clearly represented by the Rösch color body . About ICC profiles as are used for the color input and color output devices, monitor , scanner , printer , each required color spaces (RGB, CMYK) transformed. However, this transformation is not clearly possible. The materially realizable RGB color space is on the chromaticity diagram , more precisely in the CIE color space within a triangle. Such a triangle is outlined in black in the illustration opposite. Due to different transformations (mostly as a 3 × 3 matrix) of the numerical values ​​and meanwhile better technical availability, there are differently defined and standardized variants (s-RGB, Adobe-RGB, Bruce-RGB).


The RGB color space is used for self-luminous (color-displaying) systems that are subject to the principle of additive color mixing , therefore also referred to as light mixing . According to Graßmann's laws , colors can be defined by three specifications, in the RGB color space these are the red, green and blue components. The specific form of the color space depends on the specific technical system for which the respective color space was determined, including the specific wavelengths of the primary colors.

sRGB (standard RGB) was developed for monitors whose color base is three phosphors (luminescent materials). Such a substance emits a spectrum of light when electrons strike; suitable phosphors are those with narrow-band emissions at wavelengths in the range of the perceptual qualities blue, green, red. The viewer gets the color impression defined in the RGB color space (with sufficient distance from the screen the pixels merge additively). The intensity of the excitation beam corresponds to the triple in the RGB color space and can be specified, for example, as a decimal fraction (0 to 1 or 0 to 100%) or discrete with 8 bits per channel (0 ... 255) (8-bit TIFF ). Depending on the type of application, certain value representations are preferred.

With larger storage media, tone levels of 16 bits per channel became possible. Three times from 0 to 65535 ( ) are possible, for a total of 281 billion colors, for example with 16-bit TIFF and 16-bit PNG . Good technical output systems can reproduce more colors than humans can distinguish, even trained people can only get around 500,000 color nuances. For special applications, however, 16-bit values ​​make perfect sense. In this way, more precise observations are possible for evaluations in X-ray diagnostics.

The color reproduction in cases such as color pictures from PC printers, color photos on a silver halide basis, the printing of magazines, color pictures in books is done by remission on the presenting surface. The laws of subtractive color mixing, for which the CMY color space was developed, apply here because of the color depth, usually with black for color depth as the CMYK color space.

The representation of the RGB color space takes place (less clearly than with other color spaces ) in the Cartesian coordinate system as a cube . The figure shows the view of the rear wall on the left, the view in the middle, and a look inside on the right. Red, green and blue components follow the axes; in the corners are yellow, magenta, cyan. At the coordinate origin with R = G = B = 0 there is black, along the spatial diagonal gray up to the corner point in white.

Use of RGB color spaces for image reproduction

Color monitors display colors by superimposing red, green and blue pixels.

RGB color spaces as additive color spaces serve as the basis for displaying color images by means of image display devices that additively combine colors from three or more colors. In addition to CRT and TFT displays, these are also video projectors. It is irrelevant how the individual color channels are controlled, whether by an analog or a digital signal with 5, 8, 10 or 16 bits per color channel.

The three basic colors red, green and blue are usually used for representation. More “colors” can be used to increase the gamut or the maximum brightness. In this way, colors covered by the polygon can be represented better, at least with lower brightness. There is no limitation to the RGB triangle enclosed by the horseshoe. White can be used as an additional basic color to increase the maximum brightness. Greater brightness can thus be represented, but with a further loss of gamut. Both options are used with DLP projectors.

However, in these cases further processing of the RGB data of the graphics card by the output device is necessary. In the case of multi-color projection, a suitable working color space of the graphics card is necessary in order to be able to use the advantages.

The corner points of the RGB chromaticity triangle can be chosen arbitrarily; they are not restricted by the availability of fluorescent crystals. There is no inseparable connection to the three (basic) light colors that the luminescent materials of the output device can produce. Color values ​​outside the triangle defined by the corner points cannot be displayed. In a picture tube, for example, many of the strong, rich green and blue tones that occur in nature are missing, and the spectrally pure red and violet are also missing in the RGB space.

If the luminescent materials of a screen are replaced by LEDs or similar elements for red, green, blue, the color effect does not change in relation to this description provided that they can cover the RGB space used. For example, flat screens do not have a picture tube and generate the colors by means of electrical field excitation. Different phosphors require a different position of the RGB triangle (shown on the xy color sole). The technical requirement is to adapt the position of the diagram corner points for LC displays to the position in picture tubes as much as possible. If this does not succeed, a mathematical conversion has to be carried out, whereby colors can be omitted because the coordinates cannot have negative values. If the conversion is not carried out, the colors will be displayed distorted. It is possible that color nuances between red and ( yellow-orange ) are displayed noticeably differently on different devices.

Use of RGB color spaces for image acquisition

Although at first glance it looks as if the image recording is subject to the same principles as the image reproduction, there are fundamental differences for the image recording to the image reproduction:

  • Unfavorable spectra for the primary valences only lead to a small gamut during image reproduction , within which, however, perfect reproduction of the colors is possible (the triangle becomes small).
  • Unsuitable spectral sensitivities of the primary colors of an image recording device lead to mostly uncorrectable color errors (one bends the horseshoe).
  • It is not possible to build a monitor that can display all the colors that humans can perceive.
  • The dead and hot pixels of a camera can be mapped out , but this is not easily possible for a display.
Gamut of important RGB spaces

Usual RGB color spaces

In principle, there are an infinite number of color spaces that are determined by defining the primary valences, the white point and the gradation curve (gamma) (this is exactly what happens in matrix ICC profiles ). The primary valences determine the color triangle of the colors that can be displayed at low brightness levels, the white point the intensity ratio for color triples with three identical components, thus indirectly the ratio of maximum red to maximum green and blue.

The following list gives an overview of the history of the usual RGB color spaces.

  1. CIE XYZ color space
  2. CIE RGB color space
  4. Color space of PAL and SECAM
  5. sRGB color space
  6. Adobe RGB color space
  7. Wide gamut color space
  8. eciRGB color space
  9. ProPhoto RGB color space
  10. SMPTE ST2084: 2014 color space
  11. Hybrid Log Gamma color space
  12. Further development color space

The CIE XYZ color space

This XYZ color space from 1931 is the first attempt at standardization to find a uniform display system worldwide. The starting point for this was the experimentally determined cone sensitivities. The measurement technology used and the test evaluation correspond to the state of the art of the 1920s. Nevertheless, the color space is still often used in practice. The color measurement at that time used the "trick" that in light colors by mixing can generate light on the "Istseite" so to speak, negative color stimuli on the "downside". The requirement for the XYZ color space was that it encompasses all colors that can be perceived by humans. The XYZ color space is primarily a measurement color space, but it can be used to represent colors.

Since the latter encloses the entire “ horseshoe ” of all types of color, it covers all existing colors. The main problem is its unevenness. In green, the color differences perceived as the same are greater than in red and blue. The primary valences are chosen so that the color coordinates can be easily represented. They are therefore not really existing colors . So there are no real color bodies in RGB that could reproduce this color space.

The CIE RGB color space

The real CIE-RGB color space is created by converting the virtual CIE-XYZ color space (which is based on non-representable color stimuli) to the calibration stimuli of easily representable spectral lines:

  • red: 700 nm (practically all wavelengths above 650 nm are the same color for the human eye, therefore practically all spectral lines above 650 nm can be used, for example the deep red 690.7 nm Hg line)
  • green: 546.1 nm (green Hg line)
  • blue: 435.8 nm (blue Hg line)

This achieved an almost perfect coverage of red, orange, yellow and in the blue and violet area. However, there are clear weaknesses in the turquoise and green areas due to the unfavorable choice of green stimulus. In particular, not all CMYK colors can be displayed, again especially in the green to turquoise range (480 nm to 510 nm).

The color space of the early NTSC

When NTSC color television was introduced in 1953, the (then) used color phosphors were used as primary valences:

The primary valences result from the emission spectra of the phosphors used. The classic NTSC color space was replaced in 1979 by ATC (predecessor of ATSC) by a SMPTE-C color space that was more similar to the EBU color space.

Color space of PAL and SECAM as well as later NTSC (EBU 3213, ITU-R BT.470-2, SMPTE-C)

In parallel with the standardization of the color display for computer monitors with sRGB, the color television standards were revised and adapted. Since the same electronically excited starting substances are basically available for both technical systems, the options for displaying colors are almost the same. As with the sRGB color space, especially the color rendering in green has been set back compared to a better red and blue representation. There were parallel standardizations so that in addition to the EBU / ITU-R color space there is a slightly different SMPTE-C color space. With the introduction of HDTV Template: future / in 2 years, the sRGB color space is (probably) gaining acceptance for television applications.

The sRGB color space

The sRGB space was created in 1996 through a cooperation between Hewlett-Packard and Microsoft Corporation.

If the stored color triples are displayed directly, it should be possible to achieve good color reproduction without color management. The outcome was a direct relationship between stimulation and reproduced color. The sRGB is described in CCIR Rec 701 (XA / 11).

This color model was based on the available phosphors and has weaknesses in the representation of saturated red, green and blue tones. Not all colors that can be printed using CMYK in seven-color printing can be displayed. Especially in the green to turquoise range (480 nm to 510 nm) there are major deficits, which have been largely remedied by the following color space.

Adobe RGB (1998) color space

In 1998, Adobe implemented considerations that should make it possible to display all the colors of the CMYK color model relevant for printing in the new Adobe RGB (1998) gamut.

Compared to sRGB, there are significant improvements in the turquoise and green tones. However, the primary valences were set in such a way that the representation of saturated red tones has hardly improved, and that of saturated blue tones is even slightly deteriorated. However, the change did not affect the representation of the less saturated tones that occur more frequently.

The compromise consisted of balancing out the most common color reproductions in practice. When reproducing real images, the highly saturated colors appear less often than the less saturated ones. The picture quality for the majority of color reproductions is sufficiently good. Almost all colors of the CMYK seven-color printing could be reproduced in the RGB color space.

The Adobe Wide Gamut RGB color space

The Adobe RGB was a further development, but does not yet meet the increased requirements in practice. For example, company colors in advertising could not be consistently passed on from one device type to another in the workflow . That is why the so-called wide gamut was developed, again under the leadership of Adobe.

The wide gamut RGB works with the primary colors 700 nm, 525 nm and 450 nm, and higher color saturation at the technical feasibility limit. Thus, perfect coverage of red, almost perfect coverage of violet and blue and very good coverage of green tones is achieved. Slight errors in the area of ​​the extremely saturated colors in turquoise and green between 470 nm and 520 nm are accepted in favor of the requirements of practical color management.

All colors that can be printed using CMYK seven-color printing can be displayed in the Adobe Wide Gamut color space.

European Color Initiative: The eciRGB color space

The European Color Initiative ( ECI ) was founded in June 1996 on the initiative of the publishing houses Bauer, Burda, Gruner + Jahr and Springer. She deals with the media-neutral processing of color data in digital publication systems. Consistent color management should be possible in all input and output media used. The development of print media on the computer requires that the print result corresponds to the design. Version 1 was developed in 2002. In contrast to version 1, for version 2 the gamma 1.8 was replaced by an L * characterization. This results in optimized coding efficiency, especially with only 8-bit data in the depths. The current version 2 is defined in ISO 22028-2: 2007. However, there are no publicly available values ​​for this.

The DCI-P3 color space

The ProPhoto RGB color space

The ProPhoto RGB color space (also known as ROMM color space, from English: Reference Output Medium Metric ) is another further development of the wide gamut, whereby the requirements of digital photography were taken into account, in particular for subsequent processing. New considerations, research results (such as the LMS color space ) and practical requirements were used for this purpose. It provides very good coverage of almost all perceptible colors. Similar to wide-gamut RGB, only a few very saturated colors in the turquoise green and violet areas cannot be displayed.

The specified primary colors for blue and green are, however, again not really existing colors.

SMPTE ST2084: 2014 / CEA-861-3 color space (Dolby HDR)

The SMPTE ST2084: 2014 color space is an HDR color space developed by Dolby Labs. It uses light of the wavelengths 467 nm, 532 nm and 630 nm as primary valences in accordance with ITU-R recommendation BT.2020 /BT.2100.

Hybrid Log Gamma color space

The Hybrid Log Gamma color space (HLG) is an HDR color space. It uses the primary valences of BT.2020 / BT.2100. Corresponding files can be saved with the file name extension HSP .

Current developments

The RGB color space is an abstract representation for (light) colors. All color spaces can be converted into one another by suitable transformations. In some transformations, however, areas of the more extensive color spaces are mapped to the edge of the more limited color system, and the transformation is not always reversible. The RGB color space can be mapped onto the color thrombohedron , but this mapping is not reversible.

If RGB colors are described by floating point numbers, the necessary non-linear distortions for images and image conversions can be dispensed with; the color space conversions are largely superfluous. Modern programming interfaces calculate with linear relationships in the sRGB space, so that with the support of floating point no gamut clipping is necessary.

RGBA extension

Each of the above color models can be extended by one or three alpha channels for transparencies.

When expanding an alpha channel, it is assumed that (partially) transparent media replace or attenuate all three spectral colors equally with their own color. With this simple and common model, however, colored glass cannot be represented. There are two color models that either take into account the alpha channel in the foreground ( straight ) or do not take into account ( pre-multiplied ).

Models with an alpha channel (straight):

Models with one alpha channel (pre-multiplied):

Models with three alpha channels (straight):

Models with three alpha channels (pre-multiplied):

(r, g, b = red, green, blue, v = foreground, h = background)

The RGBA color model is not actually a color model, but an extension of the RGB model through the (fourth) alpha channel . This α-component determines the transparency of a pixel, which plays a role in cross-fading effects. If an image is overwritten with a new image, the information from the previous original image flows into the new target image. The alpha component determines how transparent the corresponding pixel in the image should be. α = 0 stands for complete transparency, α = 1 for complete opacity.

Conversion between different RGB color spaces

To convert between any two RGB color spaces, perform the following operations:

  • First, non-linear characteristics (gamma characteristics) must be removed again. This step can be omitted for linear characteristics:
  • The second step is to apply a matrix multiplication A to this vector:
  • The matrix A is calculated as follows , with and *: the primary valences of the source and target space in any (but the same) coordinates.
  • If the target area is non-linear, the non-linear characteristic curve of the target area must be used:
  • If the target room does not allow values ​​below a certain minimum value (usually 0.0 or 0x00) or above a certain maximum value (usually 1.0 or 0xFF) and these values ​​occur during the transformation, the color of the source room cannot be displayed in the target room. Appropriate procedures should be taken to reduce the visibility of the fault.
  • If the target space is quantized (for example to 8 bits or 12 bits), rounding errors continue to occur due to the color space conversion, which, depending on the type of rounding, can be noticeable as noise or banding.
  • If the linearization and de-linearization are omitted during the conversion, there will be clear errors, especially with saturated colors. Nevertheless, almost all software and hardware products fail to perform these calculations properly.

For the conversion of R, G, B coordinates into X, Y and Z values ​​of the CIE, special mapping matrices apply for each specific RGB color space. X is a virtual red, Y is a virtual green and Z is a virtual blue. The following figure applies to one of these color spaces (here sRGB and illuminant D65):

and the inverse matrix for the back calculation

The following relationships between sRGB and XYZ color space can be derived from this:

  • The virtual green, which is set identically to the light reference value A, runs with the G value, changes less as the red component decreases, and is hardly dependent on the blue.
  • Instead, the R value for the virtual red has to be reduced by a little G.
  • The pin -Z, the virtual blue, lies above a secondary maximum of the virtual red, which means that R but hardly G has to be deducted.

Different RGB rooms have been standardized for different device classes, all of which have the same basic structure with red, green and blue components. Accordingly, the conversion matrices were influenced by the special RGB space and the selected type of light.

Actually every device has its own device RGB color space, which is usually permitted within the standardized color space. Individual color differences can result from the device type, manufacturer, processing and production influences, as well as aging. There are (within certain limits) options for adaptation. These methods are summarized as color management . A minimum adjustment is the gamma correction . If the device parameters can be adjusted, the device can be adapted to the standardized sizes. For higher-quality requirements, the device is measured individually and the assignment of device RGB triples to the requirements triple is linked via 3 × 3 matrices or special lists (English: look-up table , LUT).

For digital image data, the RGB color space is only suitable for display on the screen and the related device types. Color definitions and contrasts of colors with one another on the Internet for display on a large number of different monitors with a wide range of graphics cards are web-safe if they comply with the recommendations of the W3C . Image data for printing (offset printing, screen printing, digital printing) must be reproduced in a subtractive color model (CMY, CMYK). The conversion from RGB to CMY is an area of ​​knowledge that is still in development (please refer to the ICC profiles).

Problems with exercising

The application of the RGB color space has its limits with perception-physiological problems.

  • Not all color valences are included in the RGB color space. In particular, the saturated spectral colors require negative reproduction components ( external color mixture ), that would be a lack of light. In optical examinations, this deficiency is remedied by additional comparative light.
  • The color perception is not independent of the absolute brightness. The excitation of the cones requires a minimum amount of light (minimum number of photons). If this is not reached, we only perceive light-dark stimuli via the rods . Above a luminance limit, there is glare, which also disrupts the system of color receptors.
  • The color perception changes across the entire field of vision. The color perception is best in the fovea centralis ; however, it decreases significantly in the periphery. The red-green color perception decreases more strongly towards the periphery than the sensitivity of the blue-yellow perception. If there are deviations of more than 30 ° from the visual axis, red-green perception is almost impossible. Other phenomena and properties of the eyes also play a role, such as the yellow spot .
  • Color perception depends on ambient light and ambient color. The color constancy of the human sense of sight is evident in automatic white balance and in perceptual illusions .
  • Genetic differences in color vision as well as possible color ametropia up to complete color inability and also brain lesions after strokes or accidents impair the comparability. Lower sensitivity of a type of cone can lead to better differentiation in certain areas of the RGB color space compared to people with normal vision. The standardized specification thus shows its weakness.

There are two pieces of technical information that are required for an exact reproduction of a color tone . On the one hand the position of the primary colors (red, green, blue) with full excitation of all channels, ie the "middle" of the xy chromaticity diagram, with x = y = 1/3 or the values ​​R = G = B = 1. This color is called reference white. On the other hand, there is the relationship between the voltage of the excitation radiation (e.g. cathode radiation) to the color result and the emitted light output (approximated by gamma, exact specification by a function depending on the applied voltage). The logarithmic relationship between color valence and color stimulus, as determined by Ewald Hering , is included in this formula.

It is therefore important to know which RGB standard was used for a good color representation.

The first two technical details are specified in standards for all manufacturers. However, the standardization of the RGB color spaces in different committees in America (FCC, ATSC), Europe (EBU) and Japan are different.


An RGB color space is a section of reality that is limited to a few, defined parameters. The perception of a “colored” light, a “surface”, includes further effects. The definition of a color by three numbers could give rise to the false expectation that a color is absolutely determined in its perception. In fact, the color effect of a numerically determined RGB color, on the other hand, depends on the specific technical system that reproduces or records this color and on the internal and external environmental conditions.

The subjective influence of brightness. Both colored areas are shown in RGB = {D1,86,00} ≈ orange, the impression "brown" arises from the assumption of a brighter lighting there. The gray tones surrounding the colored areas are identical (RGB = {70,70,70}).

An example:

The color values ​​100% red, 50% green and 0% blue (rgb = 255,127,0) result in an orange, the nuance of the orange can look very different on different playback devices despite a good preset.
This orange might look different on different screens.
Red, green, blue = hex {# FF8000} This should be the case when the same signal is applied to the adjacent cathode ray tube and liquid crystal display.
Neighboring: so that the colors can be better compared.

If the exact color space of the recording system and the color space of the playback system are known and if they remain constant, a representation that is largely approximate to the original can be achieved by converting the color space. Problems are caused by displays that have a color representation that varies, such as direction or temperature-dependent.

Color correction

To obtain predictable colors in RGB systems, color correction methods are necessary. It will find profiles using, describing how colors look and make the color space for various devices convertible. Typical color profiles, operational RGB rooms, are sRGB (standard RGB) or Adobe-RGB for general computer peripherals such as monitors and digital cameras and ECI-RGB for use in the graphics industry, for example in professional image processing. A desired goal is the wide-gamut-RGB , which defines a maximum achievable color range, which is still awaiting a solution for its representation. For transformation within the RGB color space, i.e. between operating RGB spaces or between device RGB spaces, 3 × 3 matrices are used. Another possibility is LUT (look-up tables) which contain value assignments (transformation tables) from (R, G, B) source to (R, G, B) target in list form. Linear interpolation can take place between the interpolation points. ICC profiles are such (standardized) tools.

See also

Web links

Commons : Category: RGB  - Collection of images, videos and audio files

Individual evidence

  1. extensive collection of examples, conversion matrices and transformation formulas at www.brucelindbloom.com
  2. The Eye: Physiology of Vision (3sat)
  3. Sophia Zimmermann: Lumix S1: Panasonic gives further details on mirrorless full-frame cameras , heise.de from January 8, 2019, accessed on January 8, 2019
  4. a b c RGB / XYZ matrices