sRGB | |
Long Name: | IEC 61966-2-1 Default RGB Colour Space - sRGB |
Native Name Lang: | English |
Status: | Published |
Year Started: | 1996 |
Committee: | /: TC 100/TA 2 |
Base Standards: | IEC 61966 Colour Measurement and Management in Multimedia Systems and Equipment |
Abbreviation: | sRGB |
Domain: | Color space, color model |
sRGB is a standard numerical encoding of colors, based on the RGB (red, green, blue) color space, for use on monitors, printers, and the World Wide Web. It was initially proposed by HP and Microsoft in 1996 and became an official standard of the International Electrotechnical Commission (IEC) as IEC 61966-2-1:1999. It is the current defined standard colorspace for the web, and it is usually the assumed colorspace for images that are neither tagged for a colorspace nor have an embedded color profile.
The sRGB standard uses the same color primaries and white point as the ITU-R BT.709 standard for HDTV, but a different transfer function (or gamma) compatible with the era's CRT displays, and assumes a viewing environment closer to typical home and office viewing conditions.
The sRGB color space is also the basis of the sYCC color encoding, which is a remapping of the R, G, and B components of sRGB to a luminance (brightness) value
Y
Chromaticity | Red | Green | Blue | White point | |
---|---|---|---|---|---|
x | 0.6400 | 0.3000 | 0.1500 | 0.3127 | |
y | 0.3300 | 0.6000 | 0.0600 | 0.3290 | |
Y | 0.2126 | 0.7152 | 0.0722 | 1.0000 |
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. The gamut of chromaticities that can be represented in sRGB is the color triangle defined by these primaries, which are set such that the range of colors inside the triangle is well within the range of colors visible to a human with normal trichromatic vision. As with any RGB color space, for non-negative values of R, G, and B it is not possible to represent colors outside this triangle.
The primaries come from HDTV (ITU-R BT.709), which are somewhat different from those for older color TV systems (ITU-R BT.601). These values were chosen to reflect the approximate color of consumer CRT phosphors at the time of its design. Since flat-panel displays at the time were generally designed to emulate CRT characteristics, the values also reflected prevailing practice for other display devices as well.
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. This transfer function commonly called gamma encoding, is the combination of a linear function at low brightness values and a displaced power law for the rest of the range.
Specifically, let
z
M
M
z
2N-1
N
z
v=D(z/M)
D
D(u)=\begin{cases} u/A,&u\leU\\[5mu] \left(
\displaystyleu+C | |
\displaystyle1+C |
\right)\Gamma,&u>U \end{cases}
U=0.04045
A=12.92
C=0.055
\Gamma=2.4
v=D(z/M)
z
Conversely, given a value
v
z=round(ME(v))
E
E(v)=\begin{cases} Av,&v\leV\\[5mu] (1+C)v1/\Gamma-C,&v>V \end{cases}
V=0.0031308
A
C
\Gamma
D
These sRGB encoding and decoding functions
D
E
For medium and large values of the argument
u
D
U
If needed, the encoding and decoding functions
D
E
D(-u)=-D(u)
E(-v)=-E(v)
In practice, there is still debate and confusion about the formulas used for encoding and decoding image colors from or into "sRGB" files. Also, programmers may choose use the "pure" power law
D(u)=u2.2
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. This mapping is the same specified by the BT.709 standard; in matrix notation,
\begin{bmatrix}XD65\ YD65\ ZD65\end{bmatrix} = \begin{bmatrix} 0.4124&0.3576&0.1805\\ 0.2126&0.7152&0.0722\\ 0.0193&0.1192&0.9505 \end{bmatrix} \begin{bmatrix}Rlinear\ Glinear\ Blinear\end{bmatrix}
These coefficients should be considered exact and assume the 2° standard colorimetric observer for CIE XYZ. In particular, the second row of this matrix specifies the computation of the BT.709-2 luma (brightness) value from the linear R, G, and B values. (BT.709-1 had a typo in these coefficients.)
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
\begin{bmatrix}Rlinear\ Glinear\ Blinear\end{bmatrix} =\begin{bmatrix} +3.2406&-1.5372&-0.4986\\ -0.9689&+1.8758&+0.0415\\ +0.0557&-0.2040&+1.0570 \end{bmatrix} \begin{bmatrix}XD65\ YD65\ ZD65\end{bmatrix}
M=255
The 2003 amended version of the sRGB standard points out that higher accuracy is needed when the samples are encoded with more than 8 bits. It provides the matrix
\begin{bmatrix}Rlinear\ Glinear\ Blinear\end{bmatrix} =\begin{bmatrix} +3.2406255&-1.5372080&-0.4986286\\ -0.9689307&+1.8757561&+0.0415175\\ +0.0557101&-0.2040211&+1.0569959 \end{bmatrix} \begin{bmatrix}XD65\ YD65\ ZD65\end{bmatrix}
N=16
M=65535
For these formulas, the X, Y, and Z values must be scaled so that the Y of D65 ("white") is 1.0 (X = 0.9505, Y = 1.0000, Z = 1.0890). 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:
Parameter | Value | |
---|---|---|
Screen luminance level | 80 cd/m2 | |
Illuminant white point | x = 0.3127, y = 0.3290 (D65) | |
Image surround reflectance | 20% (~medium gray) | |
Encoding ambient illuminance level | 64 lux | |
Encoding ambient white point | x = 0.3457, y = 0.3585 (D50) | |
Encoding viewing flare | 1.0% | |
Typical ambient illuminance level | 200 lux | |
Typical ambient white point | x = 0.3457, y = 0.3585 (D50) | |
Typical viewing flare | 5.0% |
For optimal results, the ICC recommends using the encoding viewing environment (i.e., dim, diffuse lighting) rather than the less-stringent typical viewing environment.
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
N
In this alternative encoding, an integer encoded sample value
z
v
v=D\left(
\displaystylez-K | |
\displaystyleW-K |
\right)
z=round(K+(W-K)E(v))
D
E
K=384
W=894
N=10
K=3 x 2N-3 W=K+255 x 2N-9
N>10
v=0
K
v=1
W
v
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. Using smaller increments for smaller signals reduces the quantization artifacts.
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. The exponent was commonly denoted with the letter
\gamma
The sRGB encoding was created a few years later by Hewlett-Packard and Microsoft. 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. The first draft of the standard was published in 1996. A fourth draft, still incomplete, is available online. Like the BT.709, the sRGB decoding function was defined as a linear section near zero that transitions to a shifted power law
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).
To derive the decoding function, one considers that the general formula for a linear function, whose graph is a straight line that passes through, is
y=x/A
y=\left(
x+C | |
1+C |
\right)\Gamma
To obtain a seamless transition between the two functions when
x
U
x | |
A |
=\left(
U+C | |
1+C |
\right)\Gamma
To avoid a sudden change of slope where the two segments meet, the derivatives must be equal at this point:
1 | |
A |
=\Gamma\left(
U+C | |
1+C |
\right)\Gamma-1\left(
1 | |
1+C |
\right)
Solving the two equations for
U
A
U=
C | |
\Gamma-1 |
A=
(1+C)\Gamma(\Gamma-1)\Gamma-1 | |
(C\Gamma-1)(\Gamma\Gamma) |
The first draft of the sRGB standard initially set the parameters at
C=0.055
\Gamma=2.4
D
U ≈ 0.0392857...
A ≈ 12.9232102...
U=0.03928
A=12.92321
A
12.92
The first official version of the standard was defined and published by the IEC in 1999. In this version, the rounded value of
A=12.92
U
0.04045
1/12.92
1/12.70
The 1999 IEC standard was amended in 2003. 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.
Due to the standardization of sRGB on the Internet, on computers, and on printers, many low- to medium-end consumer digital cameras and scanners use sRGB as the default (or only available) working color space. However, consumer-level CCDs are typically uncalibrated, meaning that even though the image or device is being labeled as "sRGB", one cannot assume that the encoded values or the colors of displayed images are accurate as specified by the standard. Recently that changed and smartphones and TVs have very good calibration out of the box.
If the color space of an image is unknown and the R, G, and B samples are encoded with 8 bits each, the sRGB encoding usually the assumed default.
As the sRGB gamut mostly meets or exceeds the gamut of a low-end inkjet printer, an sRGB image is often regarded as satisfactory for home printing. The sRGB color space is sometimes avoided by high-end print publishing professionals because its color gamut is not big enough, especially in the blue-green colors, to include all the colors that can be reproduced in CMYK printing. 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. Such CMYK and sRGB images used on the Internet may be converted to sRGB using color management tools that are usually included with software that works in these other color spaces.
The two dominant programming interfaces for 3D graphics, OpenGL and Direct3D, have both incorporated support for the sRGB gamma curve. OpenGL supports textures with sRGB gamma encoded color components (first introduced with EXT_texture_sRGB extension, added to the core in OpenGL 2.1) and rendering into sRGB gamma encoded framebuffers (first introduced with EXT_framebuffer_sRGB extension, added to the core in OpenGL 3.0). Correct mipmapping and interpolation of sRGB gamma textures has direct hardware support in texturing units of most modern GPUs (for example nVidia GeForce 8 performs conversion from 8-bit texture to linear values before interpolating those values), and does not have any performance penalty.
A lookup table may be used to efficiently convert sRGB to other color spaces. The International Color Consortium (ICC) has published color profiles for this purpose, which are widely used. There are several variants, including ICCmax, version 4, and version 2.
Version 4 is generally recommended, but version 2 is still commonly used and is the most compatible with other software including browsers.[1] However, inconsistencies have been pointed out between those ICC profiles and the IEC sRGB standard. In particular, version 2 of the ICC profile specification does not implement the piecewise parametric curve encoding ("para") as specified by the IEC sRGB standard,[2] and has to implement the linear spline using 1DLUT. What is worse in some cases "simplified sRGB" is used which is just 2.2 gamma.[3]
Amendment 1 to IEC 61966-2-1:1999, approved in 2003, includes the definition of a Y′Cb′Cr′ color representation called sYCC. Although the RGB color primaries are based on BT.709, the equations for transformation from sRGB to sYCC and vice versa are based on BT.601. 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.
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 when is negative (and is the sRGB↔linear functions described above). This is also used by scRGB.