{{short description|Standard RGB color space}}
{{Lowercase title}}
{{For|the ancillary chunk in the PNG file format|PNG#Ancillary chunks}}
{{Infobox technology standard
| title = sRGB
| long_name = IEC 61966-2-1 Default RGB Colour Space - sRGB
| native_name_lang = English
| image = SRGB chromaticity CIE1931.svg
| caption = sRGB colors situated at calculated position in {{tooltip|[[CIE 1931 color space|CIE 1931]] chromaticity diagram|edited from File:CIExy1931_sRGB.svg}}. Luminance set so that to avoid [[mach bands]].
| status = Published
| year_started = 1996
| first_published = {{Start date and age|1999|10|18}}[
| version =
| version_date =
| preview =
| preview_date =
| organization = {{abbr|[[International Electrotechnical Commission|IEC]]|International Electrotechnical Commission}}][
| committee = '''{{abbr|TC|Technical Committee}}'''/'''{{abbr|SC|Sub-committee}}''': TC 100/TA 2][
| editors =
| authors =
| base_standards = IEC 61966 Colour Measurement and Management in Multimedia Systems and Equipment
| related_standards =
| abbreviation = sRGB
| domain = [[Color space]], [[color model]]
| license =
| website = {{URL|https://webstore.iec.ch/publication/6169}}
}}
'''sRGB''' is a standard numerical encoding of colors, based on the [[RGB color spaces|RGB (red, green, blue) color space]], for use on monitors, printers, and the [[World Wide Web]]. It was initially proposed by [[Hewlett-Packard|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 [[ICC profile|embedded color profile]].
The sRGB standard uses the same color primaries and white point as [[Rec. 709|ITU-R BT.709]] standard for [[high-definition television|HDTV]],][ but a different [[transfer functions in imaging|transfer function]] (or [[gamma correction|gamma]]) compatible with the era's [[CRT display]]s,][ 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 and two [[chroma]] channels similar to those of the [[CIE]] [[YCbCr]] encoding.][
== sRGB definition ==
===Gamut===
{| class="wikitable floatright"
|-
! [[CIE 1931 color space#CIE xy chromaticity diagram and the CIE xyY color space|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 [[chromaticity|chromaticities]] of the red, green, and blue [[primary color|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 [[Trichromacy|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 ([[Rec. 709|ITU-R BT.709]]), which are somewhat different from those for older color TV systems ([[Rec. 601|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 display]]s at the time were generally designed to emulate CRT characteristics, the values also reflected prevailing practice for other display devices as well.][
=== Transfer function ("gamma") ===
[[File:SRGB gamma.svg|thumb|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.]]
[[File:srgbnonlinearity.png|thumb|On an sRGB display, each solid bar should look as bright as the surrounding striped dither. (Note: must be viewed at original, 100% size)]]
The sRGB standard specifies a non-linear encoding of physical brightness values (proportional to luminous [[power (physics)|power]] emitted per unit of area) into the integer R, G, and B values that are to be stored in computer memory or [[image file]]s. This [[transfer functions in imaging|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 be the encoded R, G, or B value, assumed to be an integer ranging from 0 (meaning no light) to some maximum (meaning the maximum displayable intensity of that channel). Typically is 255 when as an 8-bit integer, or generally for a -bit integer. The physical brightness represented by is defined as , where the decoding function is defined as][
:
where , , , and . The result is 0 for no light, and 1 for the maximum intensity. This values is sometimes called the "linear value" or "linear-light value" corresponding to the encoded sample .
Conversely, given a value between 0 and 1 that is proportional to the physical brightness to be displayed, the encoded integer brightness will be , where the encoding function is defined as][
:
where , and , , and are the same as in the decoding function .
If needed, the encoding and decoding functions , can be used for arguments greater than 1, and are extended to negative values by the identities , .][
The formulas for and above, specified by the standard, have small discontinuities at the transition between the linear and non-linear part. However, the discontinuities are too small to matter in most practical situations.][ Numerically, they are similar to those of BT.709, but noticeably different.][
In practice, there is still debate and confusion about the formulas used for encoding and decoding image colors from or into "sRGB" files. Part of the confusion is due to the value of having changed from 2.2 in the initial draft (which is widely available) to 2.4 in the final document (which is [[paywall|paywalled]])][
===Correspondence to CIE XYZ stimulus===
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 1931 color space|CIE XYZ]] perceptual color coordinates.][ This mapping is the same specified by the BT.709 standard; in matrix notation,][
:
These coefficients should be considered exact.][ They assume the 2° [[standard colorimetric observer]] for CIE XYZ.][ In particular, the second row of this matrix specifies the computation of the [[YCbCr#ITU-R BT.709 conversion|BT.709-2 luma (brightness) value]] from the linear R, G, and B values. (It should be noted that BT.709-1 had a typo in these coefficients).
According to the 2003 amended version of the standard,][ the conversion from CIE XYZ to (linear) sRGB is given by the matrix
:.
which is the approximate inverse of the sRGB-to-XYZ matrix above. For this formula, the ''X'', ''Y'', and ''Z'' values must be scaled so that the ''Y'' of [[Illuminant D65|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 color space#Forward transformation|CIELAB]], when using specified white points)
=== Viewing environment ===
[[File:Cie Chart with sRGB gamut by spigget.png|thumb|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 [[Illuminant D65|D65]] [[white point]] is shown in the center, and the [[Planckian locus]] is shown with color temperatures labeled in [[kelvin]]s. D65 is not an ideal 6504-kelvin [[black body]] because it is based on atmospheric filtered daylight.]]
{| class="wikitable" style="margin-right: 20px;"
|-
! Parameter
! Value
|-
| Screen [[luminance]] level
| 80 cd/m2
|-
| Illuminant [[white point]]
| ''x'' = 0.3127, ''y'' = 0.3290 ([[Illuminant D65|D65]])
|-
| Image surround reflectance
| 20% (~medium gray)
|-
| Encoding ambient illuminance level
| 64 [[lux]]
|-
| Encoding ambient white point
| ''x'' = 0.3457, ''y'' = 0.3585 ([[Standard illuminant#Illuminant series D|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%
|}
The sRGB specification assumes a dimly lit encoding (creation) environment with an ambient correlated color temperature (CCT) of 5003 K. This differs from the CCT of the illuminant ([[Illuminant D65|D65]]). Using [[Standard illuminant#Illuminant series D|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 [[International Color Consortium|ICC]] recommends using the encoding viewing environment (i.e., dim, diffuse lighting) rather than the less-stringent typical viewing environment.][
==History==
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 (image processing)|quantization]] artifacts.
This principle was incorporated into the digital-to-analog converters and the analog circuitry of early computer monitors, resulting in an effective [[opto-electrical transfer function|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 , hence the common name "gamma correction" and the like for this function. This mapping initially varied according to manufacturers, but was normalized in 1993 for use in HDTV systems, as the [[ITU]] [[Rec. 709|BT.709]] standard][ 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....
The sRGB encoding was originated a few years later by Hewlett-Packard and Microsoft, and was meant to describe the decoding function of most [[cathode ray tube|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 ][ The draft initially assumed a [[gamma correction|power law exponent (gamma)]] of 2.2.
====Justification for the formulas====
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 function|continuous]] (without a sudden step) and smooth (without a sudden change of slope).][
To derive the decoding function, one considers that the formula for a linear function (whose graph is a straight line that passes through {{math|(0,0)}}) is , and a shifted power law curve that passes through {{math|(1,1)}} is
To obtain a seamless transition between the two function when has a value , 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 and we get
:
:
====Parameter values====
For the sRGB standard, the decoding parameters were set at and so that the resulting curve closely resembles a pure power law with exponent 2.2. This choice implies a breakpoint and a linear coefficient . These values, rounded to and are still incorrectly given in some publications.][ However, the value of was rounded to 12.92 already in the sRGB draft standard,][ resulting in a small discontinuity in the curve.
The first official version of the standard was defined and published by the IEC in 1999. In this version, the rounded value of was retained, but the breakpoint was redefined as 0.04045 to make the curve approximately continuous. With these values, there is still a discontinuity in the slope, from 1/12.92 just below the intersection to 1/12.70 just above it. The final standard also corrected some small rounding errors present in the draft.][ The [[International Color Consortium]] (ICC) has published color specifications for the sRGB standard.][
The 1999 sRGB standard document also specified the CIE XYZ to (linear) sRGB conversion matrix as
:
which was not the exact inverse of the sRGB to XYZ transformation.
The 1999 IEC standard was amended in 2003][. The sRGB to CIE XYZ matrix was retained, but the inverse transformation (from XYZ to linear sRGB) 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.
==Usage==
[[File:CIE1931xy gamut comparison.svg|thumb|upright=1.16|Comparison of some RGB and CMYK colour gamuts on a [[CIE 1931]] xy [[chromaticity diagram]]]]
Due to the standardization of sRGB on the Internet, on computers, and on printers, many low- to medium-end consumer [[digital camera]]s and [[image scanner|scanners]] use sRGB as the [[default (computer science)|default]] (or only available) working color space. However, consumer-level [[charge-coupled device|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.
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.
An [[ICC profile]] or a [[lookup table]] may be used to convert sRGB to other color spaces. ICC profiles for sRGB are widely distributed, and the ICC distributes several variants of sRGB profiles,][ including variants for ICCmax, version 4, and version 2. However, inconsistencies have been pointed out between those ICC profiles and the IEC sRGB standard.][ Version 4 is generally recommended, but version 2 is still commonly used and is the most compatible with other software including browsers. Version 2 of the ICC profile specification does not officially support piecewise parametric curve encoding ("para"), though version 2 does support simple power-law functions.][ Nevertheless, lookup tables are more commonly used as they are computationally more efficient.{{citation needed|date=November 2021}} Even when parametric curves are used, software will often reduce to a run-time lookup table for efficient processing.{{citation needed|date=November 2021}}
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 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 color space|Adobe RGB (1998)]], 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 [[texture mapping|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 [[framebuffer]]s (first introduced with EXT_framebuffer_sRGB extension,][ added to the core in OpenGL 3.0). Correct [[mipmap]]ping and [[interpolation]] of sRGB gamma textures has direct hardware support in texturing units of most modern [[GPU]]s (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.][
== The sYCC color space ==
Amendment 1 to IEC 61966-2-1:1999, approved in 2003, includes the definition of a [[YCbCr|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 [[Rec. 601|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.][
The 2003 amendment of the sRGB standard also contains a 10-bit-or-more encoding called '''bg-sRGB''' where 0–1 is mapped to {{Frac|-384|510}}...{{frac|639|510}}, and '''bg-sYCC''' using the same number of bits for a range of approximately -0.75–1.25 for Y; -1–1 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 {{math|−''f''(−''x'')}} when {{mvar|x}} is negative (and {{mvar|f}} is the sRGB↔linear functions described above). This is also used by [[scRGB]].
==References==
{{notelist}}
][{{cite web|author1=Michael Stokes|author2=Matthew Anderson|author3=Srinivasan Chandrasekar|author4=Ricardo Motta|date=November 5, 1996|title=A Standard Default Color Space for the Internet – sRGB, Version 1.10|url=https://www.w3.org/Graphics/Color/sRGB.html|url-status=live|archive-url=https://web.archive.org/web/20230703221707/https://www.w3.org/Graphics/Color/sRGB.html |archive-date=Jul 3, 2023 |access-date=|website=}}]
[{{cite web|title=IEC 61966-2-1:1999|url=https://webstore.iec.ch/publication/6169|website=IEC Webstore|publisher=International Electrotechnical Commission|access-date=3 March 2017}}. The first official specification of sRGB.]
[{{cite book |title=Digital Video and HDTV: Algorithms and Interfaces |author=Charles A. Poynton |publisher=Morgan Kaufmann |year=2003 |isbn=1-55860-792-7 |url=https://books.google.com/books?id=ra1lcAwgvq4C&q=rec+709+smpte&pg=RA1-PA239}}]
[{{cite book|author1=Phil Green|url=https://books.google.com/books?id=tn09voxr6agC&q=srgb+0.03928+date:0-2002&pg=PA350|title=Colour Engineering: Achieving Device Independent Colour|author2=Lindsay W. MacDonald|publisher=John Wiley and Sons|year=2002|isbn=0-471-48688-4|name-list-style=amp}}]
[[https://color.org/srgbprofiles.xalter sRGB profiles], ICC]
[{{cite web |last1=Summers |first1=Jason |title=A close look at the sRGB formula |url=https://entropymine.com/imageworsener/srgbformula/ |website=entropymine.com}}]
[{{Cite web|first=Daniele|last=Siragusano|date=July 17, 2020|title=Colour Online: sRGB... We Need To Talk|website=FilmLight|url=https://www.youtube.com/watch?v=NzhUzeNUBuM|access-date=2024-09-01}}]
[{{cite book|author=Jon Y. Hardeberg|url=https://books.google.com/books?id=e2umTIdI2u4C&q=srgb+0.00304+date:0-2002&pg=PA40|title=Acquisition and Reproduction of Color Images: Colorimetric and Multispectral Approaches|publisher=Universal-Publishers.com|year=2001|isbn=1-58112-135-0}}]
[{{cite web|url=https://color.org/chardata/rgb/sRGB.pdf|title=How to interpret the sRGB color space|website=color.org|language=en|access-date=17 October 2017}}]
[{{cite report|last=Roberts|first=A.|title=BBC RD 1991/6 Methods of Measuring and Calculating Display Transfer Characteristics|url=https://downloads.bbc.co.uk/rd/pubs/reports/1991-06.pdf|publisher=BBC|pages=1}}]
[{{Cite web |last= |first= |date=2015-12-05 |title=The Importance of Terminology and sRGB Uncertainty |url=https://www.colour-science.org/posts/the-importance-of-terminology-and-srgb-uncertainty/ |access-date=2021-11-05 |website=Colour Science |language=en}}]
[{{Cite web|url=https://www.itu.int/rec/R-REC-BT.709|title=BT.709 : Parameter values for the HDTV standards for production and international programme exchange|website=www.itu.net|date=n.d.|access-date=2021-04-19}}]
[{{cite web |title=EXT_texture_sRGB |date=24 January 2007 |url=https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB.txt |access-date=12 May 2020}}]
[{{cite web |title=EXT_framebuffer_sRGB |date=17 September 2010 |url=https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt |access-date=12 May 2020}}]
[{{cite web |title=GPU Gems 3: Chapter 24. The Importance of Being Linear, section 24.4.1 |publisher=NVIDIA Corporation |url=https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-24-importance-being-linear |access-date=3 March 2017}}]
[{{cite web |url=https://webstore.iec.ch/publication/6168 |title=IEC 61966-2-1:1999 Multimedia systems and equipment – Colour measurement and management – Part 2-1: Colour management – Default RGB colour space – sRGB: Amendment 1 |date=2003 |publisher=[[International Electrotechnical Commission]]}} Replaces IEC 61966-2-1:1999][, introducing the sYCC encoding for [[YCbCr]] color spaces, an extended-[[gamut]] RGB encoding, and a [[CIELAB]] transformation.]
[[https://web.archive.org/web/20141225172302/http://www2.units.it/ipl/students_area/imm2/files/Colore1/sRGB.pdf fourth working draft (4WD) for 2CD of IEC 61966-2-1], (archived). Still not the complete standard.]
[[https://web.archive.org/web/20030124233043/http://www.srgb.com/ sRGB.com Notes on design and use of sRGB] (archived) by [[Hewlett Packard|HP]].]
[[https://www.image-engineering.de/library/technotes/714-color-spaces-rec-709-vs-srgb Color spaces - REC.709 vs. sRGB] from Image Engineering GmbH & Co. KG, with a graph comparing two transfer functions.]
[[https://www.color.org/chardata/rgb/srgb.xalter sRGB] Characterization Data from ICC]
[[https://www.color.org/sRGB.pdf How to interpret the sRGB color space (specified in IEC 61966-2-1) for ICC profiles] from ICC]
[[http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html Conversion matrices for RGB vs. XYZ conversion] by Bruce Justin Lindbloom]
[{{cite book |last=Rodney |first=Andrew |url=https://books.google.com/books?id=jFl-3v9sSEUC&q=%22My+suggestion+is+to+calibrate+to+a+D65+white+point.%22&pg=PA121 |title=Color Management for Photographers |publisher=Focal Press |year=2005 |isbn=978-0-240-80649-5 |page=121 |quote=}}]
[{{Cite web |title=Why Calibrate Monitor to D65 When Light Booth is D50 |url=https://www.xrite.com/service-support/why_calibrate_monitor_to_d65_when_light_booth_is_d50 |access-date=2022-09-11 |website=X-Rite |language=en}}]
[[https://ninedegreesbelow.com/photography/srgb-profile-comparison.html Will the Real sRGB Profile Please Stand Up?] by Elle Stone. Analyzes the inconsistency among sRGB ICC profiles]
==External links==
* [https://www.shadertoy.com/view/7sjBWD Test that shows whether your display is pure 2.2 gamma or sRGB (~2.2 gamma)] on [[Shadertoy]]
*
{{Color space}}
[[Category:1996 introductions]]
[[Category:Color space]]
[[Category:Film and video technology]]