SRGB
sRGB is an RGB color space that HP and Microsoft created cooperatively in 1996 to use on monitors, printers, and the Web. It was subsequently standardized by the IEC as IEC 61966-2-1:1999. It is often the "default" color space for images that contain no color space information, especially if the images' pixels are stored in 8-bit integers per color channel.
sRGB uses the ITU-R BT.709 primaries, the same as in studio monitors and HDTV, a transfer function typical of CRTs, and a viewing environment designed to match typical home and office viewing conditions. This specification allowed sRGB to be directly displayed on typical CRT monitors of the time, which greatly aided its acceptance.
The sRGB gamut
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 |
sRGB 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. 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, which is well inside the range of colors visible to a human with normal trichromatic vision.
The primaries come from HDTV, which in turn is based on Color TV. These values reflect the approximate color of consumer CRT phosphors.
The sRGB transfer function ("gamma")
sRGB also defines a nonlinear transfer function between the intensity of these primaries and the actual number stored. The curve is similar to the gamma response of a CRT display. This nonlinear conversion means that sRGB is a reasonably efficient use of the values in an integer-based image file to display human-discernible light levels.Unlike most other RGB color spaces, the sRGB gamma cannot be expressed as a single numerical value. The overall gamma is approximately 2.2, consisting of a linear section near black, and a non-linear section elsewhere involving a 2.4 exponent and a gamma changing from 1.0 through about 2.3. The purpose of the linear section is so the curve does not have an infinite slope at zero, which could cause numerical problems.
Ambiguity in the definition of the term "gamma"
Annex A from the sRGB specification states the following:Historically, both the photographic and television industries claim integral use of the term "gamma" for different effects. Hurter and Driffield first used the term in the 1890s in describing the straight-line portion of the density versus log exposure curves that describe photographic sensitometry. The photographic sensitometry field has used several interrelated terms to describe similar effects, including gamma, slope, gradient, and contrast. Both Languimier in the 1910s and Oliver in the 1940s defined "gamma" for the television industry as the exponential value in both simple and complex power functions that describe the relationship between gun voltage and intensity. In fact, even within the television industry, there are multiple, conflicting definitions of "gamma". These include differences in describing physical aspects. These also include differences in equations for the same physical aspect. After significant insightful feedback from many industries, this standard has explicitly chosen to avoid the use of the term "gamma". Furthermore, it appears that the usefulness of the term in unambiguous, constructive standard terminology is zero and its continued use is detrimental to consistent cross-reference between standards and unambiguous communication.
Specification of the transformation
The forward transformation (CIE XYZ to sRGB)
The CIE XYZ values must be scaled so that the Y of D65 is 1.0. This is usually true but some color spaces use 100 or other values.The first step in the calculation of sRGB from CIE XYZ is a linear transformation, which may be carried out by a matrix multiplication.
These linear RGB values are not the final result; gamma correction must still be applied.
The following formula transforms the linear values into sRGB:
- where is,, or.
The reverse transformation
Again the sRGB component values,, are in the range 0 to 1..- where is,, or.
Theory of the transformation
It is often casually stated that the decoding gamma for sRGB data is 2.2, yet the above transform shows an exponent of 2.4. This is because the net effect of the piecewise decomposition is necessarily a changing instantaneous gamma at each point in the range: it goes from gamma = 1 at zero to a gamma of 2.4 at maximum intensity with a median value being close to 2.2. The transformation was designed to approximate a gamma of about 2.2, but with a linear portion near zero to avoid having an infinite slope at K = 0, which can cause numerical problems. The continuity condition for the curve, which is defined above as a piecewise function of, isSolving with and the standard value yields two solutions, ≈ or. The IEC 61966-2-1 standard uses the rounded value, which yields. However, if we impose the condition that the slopes match as well then we must have
We now have two equations. If we take the two unknowns to be and then we can solve to give
Substituting or and gives and, with the corresponding linear-domain threshold at. These values, rounded to, and, sometimes describe sRGB conversion. Publications by sRGB's creators rounded to and, hence, resulting in a small discontinuity in the curve. Some authors adopted these values in spite of the discontinuity. For the standard, the rounded value was kept and the value was recomputed to make the resulting curve continuous, as described above, resulting in a slope discontinuity from 12.92 below the intersection to 12.70 above.
Viewing environment
Parameter | Value |
Screen luminance level | 80 cd/m2 |
Illuminant white point | x = 0.3127, y = 0.3290 |
Image surround reflectance | 20% |
Encoding ambient illuminance level | 64 lux |
Encoding ambient white point | x = 0.3457, y = 0.3585 |
Encoding viewing flare | 1.0% |
Typical ambient illuminance level | 200 lux |
Typical ambient white point | x = 0.3457, y = 0.3585 |
Typical viewing flare | 5.0% |
The sRGB specification assumes a dimly lit encoding environment with an ambient correlated color temperature of 5000 K. This differs from the CCT of the illuminant. Using D50 for both would have made the white point of most photographic paper appear excessively blue. The other parameters, such as the luminance level, are representative of a typical CRT monitor.
For optimal results, the ICC recommends using the encoding viewing environment rather than the less-stringent typical viewing environment.
Usage
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 working color space. However, consumer-level CCDs are typically uncalibrated, meaning that even though the image is being labeled as sRGB, one can't conclude that the image is color-accurate sRGB.If the color space of an image is unknown and it is an 8- to 16-bit image format, assuming it is in the sRGB color space is a safe choice. An ICC profile may be used; the ICC distributes three such profiles: two profiles conforming to version 4 of the ICC specification, which they recommend, and one profile conforming to version 2, which is still commonly used.
As the sRGB gamut meets or exceeds the gamut of a low-end inkjet printer, an sRGB image is often regarded as satisfactory for home use and printing. sRGB 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, which accommodates a wider gamut. Such 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 and rendering into sRGB gamma encoded framebuffers
.
Direct3D supports sRGB gamma textures and rendering into sRGB gamma surfaces starting with DirectX 9. Correct mipmapping and interpolation of sRGB gamma textures has direct hardware support in texturing units of most modern GPUs, and does not have any performance penalty.
Standards
- IEC 61966-2-1:1999 is the official specification of sRGB. It provides viewing environment, encoding, and colorimetric details.
- Amendment A1:2003 to IEC 61966-2-1:1999 describes an analogous sYCC encoding for YCbCr color spaces, an extended-gamut RGB encoding, and a CIELAB transformation.
- sRGB on
- The fourth working draft of IEC 61966-2-1 is available online, but is not the complete standard. It can be downloaded from .