sRGB

The sRGB standard uses the same color primaries and white point as the ITU-R BT.709 standard for HDTV,[3] but a different transfer function (or gamma) compatible with the era's CRT displays,[4] and assumes a viewing environment closer to typical home and office viewing conditions.

[5] The sRGB standard defines the chromaticities of the red, green, and blue primaries, the colors where one of the three channels is nonzero and the other two are zero.

These values were chosen to reflect the approximate color of consumer CRT phosphors at the time of its design.

[1] The sRGB standard specifies a non-linear encoding of physical brightness values (proportional to luminous power emitted per unit of area) into the integer R, G, and B values that are to be stored in computer memory or image files.

be the encoded R, G, or B value, assumed to be an integer ranging from 0 (meaning no light) to some maximum

[5] In practice, there is still debate and confusion about the formulas used for encoding and decoding image colors from or into "sRGB" files.

instead of the correct piecewise formulas above, for the sake of code simplicity or efficiency, but that would introduce some issues near black.

Also, some operating systems and programs may directly send sRGB encoded images to monitors which actually have a different effective decoding function, such as pure power law with 2.2 exponent, this is further complicated by the standard saying that reference CRT display should use 2.2 gamma.

[7] The sRGB standard specifies also the colors and relative intensities of the three primaries R, G, and B, by defining the mapping between these values (in linear brightness scale, before the gamma encoding) and the CIE XYZ perceptual color coordinates.

The inverse conversion, from from CIE XYZ to (linear) sRGB, can be obtained by inverting the matrix above to a suitable numerical accuracy.

The 1999 standard provides the matrix which is not the exact inverse of the sRGB to XYZ transformation, but was expected to be accurate enough for 8-bit encoded samples (with

The 2003 amended version of the sRGB standard[5] points out that higher accuracy is needed when the samples are encoded with more than 8 bits.

This is usually true but some color spaces use 100 or other values (such as in CIELAB, when using specified white points).

The sRGB specification assumes a dimly lit encoding (creation) environment with an ambient correlated color temperature (CCT) of 5003 K: The assumed ambient CCT differs from that of the BT.709 standard illuminant (D65), which is still retained for the screen white point.

[13] Annex G of the 2003 amendment of the sRGB standard describes an alternative encoding of color values, called bg-sRGB, that is recommended when the number of bits per channel

This encoding is useful for color space manipulations (like the conversion from sYCC) that can generate values

[5] The non-linear encoding of physical data samples is a common digital signal processing technique that aims to make better use of the bits available for the encoded signal, taking into account the non-linear way human senses perceive physical stimuli.

This principle was incorporated into the digital-to-analog converters and the analog circuitry of early computer monitors, resulting in an effective decoding function (the mapping from digital sample values to the displayed intensity) which was roughly a power law with an exponent between 2 and 3.

This mapping initially varied according to CRT manufacturers, but was normalized in 1993 for use in HDTV systems, as the ITU BT.709 standard[14] The BT.709 standard specified a decoding function with a linear section near zero, transitioning to a shifted power law with exponent 1/0.45 ≈ 2.2222....

It was meant to describe the decoding function of most CRT computer monitors used with Windows operating systems at the time, which was still different from that assumed by BT.709.

[16] Like the BT.709, the sRGB decoding function was defined as a linear section near zero that transitions to a shifted power law [17][18] In theory, the parameters of the encoding and decoding functions should be chosen so that the transition from the linear section to the power law section is continuous (without a sudden step) and smooth (without a sudden change of slope).

, we must have To avoid a sudden change of slope where the two segments meet, the derivatives must be equal at this point: Solving the two equations for

closely resembled a pure power law with exponent (gamma) 2.2, assimed to be typical of computer monitors at the time.

The final standard also corrected some small rounding errors present in the draft.

[5] The sRGB to CIE XYZ matrix was retained, but the inverse transformation above was replaced by a more accurate version, with seven decimal fraction digits.

The amended standard also included the definition of the sYCC encoding, using brightness (Y) and two chroma coordinates (CC) instead of R, G, and B coordinates, and a bg-sRGB encoding for 10-bit components which allows some component values outside the 0-1 range.

Images intended for professional printing via a fully color-managed workflow (e.g. prepress output) sometimes use another color space such as Adobe RGB (1998), which accommodates a wider gamut and CMYK color space like Fogra39.

The two dominant programming interfaces for 3D graphics, OpenGL and Direct3D, have both incorporated support for the sRGB gamma curve.

[27] Amendment 1 to IEC 61966-2-1:1999, approved in 2003, includes the definition of a Y′Cb′Cr′ color representation called sYCC.

The sYCC standard specifies 8 bits for the encoded components, and the matrices result in a range of approximately 0–1 for Y; -0.5–0.5 for C.[5] As this conversion can result in sRGB values outside the range 0–1, the amendment describes how to apply the gamma correction to negative values, by applying −f(−x) when x is negative (and f is the sRGB↔linear functions described above).

Plot of the sRGB intensities (red), and this function's slope in log-log space (blue), which is the instantaneous gamma. Below a compressed value of 0.04045 or a linear intensity of 0.00313, the curve is linear so the gamma is 1. Behind the red curve is a dashed black curve showing an exact gamma = 2.2 power law.
On an sRGB display, each solid bar should look as bright as the surrounding striped dither. (Note: must be viewed at original, 100% size)
CIE 1931 xy chromaticity diagram showing the gamut of the sRGB color space (the triangle). The outer curved boundary is the spectral (or monochromatic) locus, with wavelengths shown in nanometers (labeled in blue). This image is drawn using sRGB, so colors outside the triangle cannot be accurately colored and have been interpolated. The D65 white point is shown in the center, and the Planckian locus is shown with color temperatures labeled in kelvins . D65 is not an ideal 6504-kelvin black body because it is based on atmospheric filtered daylight.
Comparison of some RGB and CMYK colour gamuts on a CIE 1931 xy chromaticity diagram