Jump to content

SRGB: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
→‎Standards: add link to official standard
 
(35 intermediate revisions by 17 users not shown)
Line 27: Line 27:
}}
}}


'''sRGB''' is a [[Standardization|standard]] [[RGB color spaces|RGB (red, green, blue) color space]] that [[Hewlett-Packard|HP]] and [[Microsoft]] created cooperatively in 1996 to use on monitors, printers, and the [[World Wide Web]].<ref name="orig_pub" /> It was subsequently standardized by the [[International Electrotechnical Commission]] (IEC) as IEC 61966-2-1:1999.<ref name="iecstd" /> sRGB is the current defined standard [[color space|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]].
'''sRGB''' is a standard [[RGB color spaces|RGB (red, green, blue) color space]] that [[Hewlett-Packard|HP]] and [[Microsoft]] created cooperatively in 1996 to use on monitors, printers, and the [[World Wide Web]].<ref name="orig_pub" /> It was subsequently standardized by the [[International Electrotechnical Commission]] (IEC) as IEC 61966-2-1:1999.<ref name="iecstd" /> sRGB 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]].


sRGB essentially codifies the display specifications for the computer monitors in use at that time, which greatly aided its acceptance. sRGB uses the same color primaries and white point as [[Rec. 709|ITU-R BT.709]] standard for [[high-definition television|HDTV]],<ref>{{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}}</ref> a [[transfer functions in imaging|transfer function]] (or [[gamma correction|gamma]]) compatible with the era's [[cathode-ray tube|CRT displays]], and a viewing environment designed to match typical home and office viewing conditions.
sRGB essentially codifies the display specifications for the computer monitors in use at that time, which greatly aided its acceptance. sRGB uses the same color primaries and white point as [[Rec. 709|ITU-R BT.709]] standard for [[high-definition television|HDTV]],<ref>{{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}}</ref> a [[transfer functions in imaging|transfer function]] (or [[gamma correction|gamma]]) compatible with the era's [[CRT display]]s, and a viewing environment designed to match typical home and office viewing conditions.


== sRGB definition ==
== sRGB definition ==
Line 61: Line 61:
|}
|}


sRGB 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. 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 [[Trichromacy|trichromatic]] vision.
sRGB 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.<ref name="iecstd"/>
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.<ref name="iecstd"/>
Line 70: Line 70:
[[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)]]
[[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 IEC specification indicates a reference display with a nominal [[gamma correction|gamma]] of 2.2 similar to the gamma response of [[cathode-ray tube|CRT]] displays (a more accurate value is 2.3<ref>{{Cite web |last=Roberts |first=A. |date=1992 |title=Measurements of display transfer characteristics using test pictures. BBC Research Department Report RD 1992/13 |url=http://downloads.bbc.co.uk/rd/pubs/reports/1992-13.pdf |access-date=10 August 2023}}</ref>) The ability to directly display sRGB images on a CRT without any lookup greatly helped sRGB's adoption. Gamma also conveniently places more numbers near the black, reducing visible [[Quantization (image processing)|quantization]] artifacts.
The reference display characterisation is based on the characterisation in [[International Commission on Illumination|CIE]] 122. The reference display is characterised by a nominal power-law [[gamma correction|gamma]] of 2.2, which the sRGB working group determined was representative of the CRTs used with Windows operating systems at the time.<ref name="orig_pub" /> The ability to directly display sRGB images on a CRT without any lookup greatly helped sRGB's adoption.{{Citation needed|date=November 2023|reason=unsubstantiated}} Gamma also usefully encodes more data near the black, which reduces visible noise and [[Quantization (image processing)|quantization]] artifacts.


The standard further defines a nonlinear [[transfer functions in imaging|electro-optical transfer function]] (EOTF), which exactly defines the conversion from image data to output intensity. This curve is a slight tweaking of {{math|''x''{{sup|2.2}}}}.<ref>{{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}}</ref> A linear section is near zero, in order to avoid an infinite or zero slope that an exponential has, this is spliced to a curved section designed so the overall function is very close. In order to do this a formula using a higher exponent (2.4 in this case) is necessary. The ''instantaneous'' gamma (the slope when plotted on a log:log scale) varies from 1 in the linear section to 2.4 at maximum intensity, with a median value being close to 2.2.
The standard also defines a [[transfer functions in imaging|opto-electronic transfer function]] (OETF), which defines the conversion of linear light or signal intensity to a gamma-compressed image data. It is a piecewise compound function and has an approximate <math>\gamma</math> of 2.2, with a linear portion near zero to avoid an infinite slope which emphasizes signal (camera) noise.<ref>{{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}}</ref><ref>{{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}}</ref> Near zero, a <math>\gamma^{1/2.4}</math> power law curve intercepts a straight-line section that leads to zero.


In practice, there is still debate and confusion around whether sRGB data should be displayed with pure 2.2 gamma as defined in the standard, or with the inverse of the OETF. Some display manufacturers and calibrators use the former, while some use the latter. When a power law <math>\gamma^{2.2}</math> is used to display data that was intended to be displayed on displays that use the piecewise function, the result is that the shadow details will be "crushed" towards hard black.<ref>{{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}}</ref>
In practice a pure {{math|''x''{{sup|2.2}}}} may be used with sRGB data with very little difference, this is referred to as "simple sRGB" by Adobe, and also what happens when it is displayed unchanged on a CRT.


==== Computing the transfer function ====
==== Computing the inverse opto-eletronic transfer function ====


A straight line that passes through {{math|(0,0)}} is <math>y = \frac{x}{\Phi}</math>, and a gamma curve that passes through {{math|(1,1)}} is <math>y = \left(\frac{x+A}{1+A}\right)^\Gamma</math>
A straight line that passes through {{math|(0,0)}} is <math>y = \frac{x}{\Phi}</math>, and a gamma curve that passes through {{math|(1,1)}} is <math>y = \left(\frac{x+A}{1+A}\right)^\Gamma</math>
Line 94: Line 94:
The values {{math|1=''A'' = 0.055}} and {{math|1=Γ = 2.4}} were chosen{{how|date=November 2021}} so the curve closely resembled the gamma-2.2 curve. This gives {{math|1=''X'' ≈ 0.0392857, Φ ≈ 12.9232102}}. These values, rounded to {{math|1=''X'' = 0.03928, Φ = 12.92321}} sometimes describe sRGB conversion.<ref>{{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}}</ref>
The values {{math|1=''A'' = 0.055}} and {{math|1=Γ = 2.4}} were chosen{{how|date=November 2021}} so the curve closely resembled the gamma-2.2 curve. This gives {{math|1=''X'' ≈ 0.0392857, Φ ≈ 12.9232102}}. These values, rounded to {{math|1=''X'' = 0.03928, Φ = 12.92321}} sometimes describe sRGB conversion.<ref>{{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}}</ref>


Draft publications by sRGB's creators further rounded {{math|1=Φ = 12.92}},<ref name="orig_pub" /> resulting in a small discontinuity in the curve. Some authors adopted these incorrect values, in part because the draft paper was freely available and the official IEC standard is behind a paywall.<ref>{{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}}</ref> For the standard, the rounded value of {{math|Φ}} was kept and {{mvar|X}} was recomputed as {{math|0.04045}} to make the curve continuous, resulting in a slope discontinuity from {{math|1/12.92}} below the intersection to {{math|1/12.70}} above.
Draft publications by sRGB's creators further rounded {{math|1=Φ = 12.92}},<ref name="orig_pub" /> resulting in a small discontinuity in the curve. Some authors adopted these incorrect values, in part because the draft paper was freely available and the official IEC standard is behind a paywall.<ref>{{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}}</ref> For the standard, the rounded value of {{math|Φ}} was kept and {{mvar|X}} was recomputed as {{math|0.04045}} to make the curve continuous,{{efn|The function is still very slightly non-continuous due to the prescribed value of "0.0031308" for toLinear(''X''). However, the discontinuity is too small to make a practical difference.<ref>{{cite web |last1=Summers |first1=Jason |title=A close look at the sRGB formula |url=https://entropymine.com/imageworsener/srgbformula/ |website=entropymine.com}}</ref>}} resulting in a slope discontinuity from {{math|1/12.92}} below the intersection to {{math|1/12.70}} above.


=== Viewing environment ===
=== Viewing environment ===
Line 147: Line 147:
where <math>C</math> is <math>R</math>, <math>G</math>, or <math>B</math>.
where <math>C</math> is <math>R</math>, <math>G</math>, or <math>B</math>.


These [[gamma correction|gamma-expanded]] values (sometimes called "linear values" or "linear-light values") are multiplied by a matrix to obtain CIE XYZ (the matrix has infinite precision, any change in its values or adding not zeroes is not allowed):
These [[gamma correction|gamma-expanded]] values (sometimes called "linear values" or "linear-light values") are multiplied by a matrix to obtain CIE XYZ (the matrix has infinite precision, any change in its values or adding non-zeroes is not allowed):


:<math>
:<math>
Line 177: Line 177:
</math>
</math>


These linear RGB values are ''not'' the final result; gamma correction must still be applied.
These linear RGB values are {{em|not}} the final result; gamma correction must still be applied.
The following formula transforms the linear values into sRGB:
The following formula transforms the linear values into sRGB:


:<math>C_\text{sRGB} = \begin{cases}
:<math>C_\text{sRGB} = \begin{cases}
12.92C_\text{linear}, & C_\text{linear} \le 0.0031308 \\[5mu]
12.92 C_\text{linear}, & C_\text{linear} \le 0.0031308 \\[5mu]
1.055C_\text{linear}^{1/2.4}-0.055, & C_\text{linear} > 0.0031308
1.055 (C_\text{linear}^{1/2.4})-0.055, & C_\text{linear} > 0.0031308
\end{cases}</math>
\end{cases}</math>
where <math>C</math> is <math>R</math>, <math>G</math>, or <math>B</math>.
where <math>C</math> is <math>R</math>, <math>G</math>, or <math>B</math>.
Line 193: Line 193:
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 is being labeled as sRGB, one can not conclude that the image is color-accurate sRGB.
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 is being labeled as sRGB, one can not conclude that the image is color-accurate sRGB.


If the color space of an image is unknown and it is an 8&nbsp;bit image format, sRGB is usually the assumed default, in part because color spaces with a larger gamut need a higher bit depth to maintain a low color error rate (∆E). An [[ICC profile]] or a [[look up 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,<ref name="ICCspec">[https://color.org/srgbprofiles.xalter sRGB profiles], ICC</ref> including variants for 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. 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.<ref name="ICCspec" /> 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}}
If the color space of an image is unknown and it is an 8&nbsp;bit image format, sRGB is usually the assumed default, in part because color spaces with a larger gamut need a higher bit depth to maintain a low color error rate (∆E). 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,<ref name="ICCspec">[https://color.org/srgbprofiles.xalter sRGB profiles], ICC</ref> including variants for 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. 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.<ref name="ICCspec"/> 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. 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 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.
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. 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 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.
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,<ref>{{cite web |title=EXT_texture_sRGB |url=https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB.txt |date=24 January 2007 |access-date=12 May 2020}}</ref> added to the core in OpenGL 2.1) and rendering into sRGB gamma encoded [[framebuffer]]s (first introduced with EXT_framebuffer_sRGB extension,<ref>{{cite web |title=EXT_framebuffer_sRGB |url=https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt |date=17 September 2010 |access-date=12 May 2020}}</ref> 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.<ref>{{cite web |title=GPU Gems 3: Chapter 24. The Importance of Being Linear, section 24.4.1 |url=https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-24-importance-being-linear |publisher=NVIDIA Corporation |access-date=3 March 2017}}</ref>
OpenGL supports [[texture mapping|textures]] with sRGB gamma encoded color components (first introduced with EXT_texture_sRGB extension,<ref>{{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}}</ref> added to the core in OpenGL 2.1) and rendering into sRGB gamma encoded [[framebuffer]]s (first introduced with EXT_framebuffer_sRGB extension,<ref>{{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}}</ref> 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.<ref>{{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}}</ref>


== sYCC ==
== sYCC ==
Line 218: Line 219:


==References==
==References==
{{notelist}}
{{Reflist}}
{{Reflist}}


===Standards===
===Standards===
* IEC 61966-2-1:1999 is the official specification of sRGB. It provides viewing environment, encoding, and [[colorimetric]] details.
* [https://webstore.iec.ch/en/publication/6169 IEC 61966-2-1:1999] is the official specification of sRGB. It provides viewing environment, encoding, and [[colorimetric]] details.
* [https://webstore.iec.ch/publication/6168 Amendment A1:2003] to IEC 61966-2-1:1999 describes an sYCC encoding for [[YCbCr]] color spaces, an extended-[[gamut]] RGB encoding, and a [[CIELAB]] transformation.
* [https://webstore.iec.ch/publication/6168 Amendment A1:2003] to IEC 61966-2-1:1999 describes an sYCC encoding for [[YCbCr]] color spaces, an extended-[[gamut]] RGB encoding, and a [[CIELAB]] transformation.
* [https://www.color.org/chardata/rgb/srgb.xalter sRGB], International Color Consortium
* [https://www.color.org/chardata/rgb/srgb.xalter sRGB], Characterization Data from [[International Color Consortium|ICC]]
* The fourth working draft of IEC 61966-2-1 is available online, but is not the complete standard. It can be downloaded from [http://www2.units.it/ipl/students_area/imm2/files/Colore1/sRGB.pdf www2.units.it].
* The fourth working draft (4WD) for 2CD of IEC 61966-2-1 is [https://web.archive.org/web/20141225172302/http://www2.units.it/ipl/students_area/imm2/files/Colore1/sRGB.pdf available online (archived)], but is not the complete standard.
* [https://web.archive.org/web/20030124233043/http://www.srgb.com/ Archive copy of sRGB.com], now unavailable, containing much information on the design, principles, and use of sRGB
* [https://web.archive.org/web/20030124233043/http://www.srgb.com/ Web archive of sRGB.com] {{dash}} information on the design, principles, and use of sRGB


==External links==
==External links==
* [https://www.color.org/ International Color Consortium]
* [https://www.color.org/ International Color Consortium]
* [https://www.w3.org/Graphics/Color/sRGB A Standard Default Color Space for the Internet sRGB] the early, obsolete draft of the standard at [[World Wide Web Consortium|w3.org]]
* [https://www.color.org/sRGB.pdf How to interpret the sRGB color space (specified in IEC 61966-2-1) for ICC profiles] from [[ International Color Consortium|ICC]]
* [http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html Conversion matrices for RGB vs. XYZ conversion]
* [http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html Conversion matrices for RGB vs. XYZ conversion] by Bruce Justin Lindbloom
* [https://www.shadertoy.com/view/7sjBWD Test that shows whether your display is 2.2 gamma or sRGB]
* [https://www.shadertoy.com/view/7sjBWD Test that shows whether your display is pure 2.2 gamma or sRGB (~2.2 gamma)] on [[Shadertoy]]
* [https://ninedegreesbelow.com/photography/srgb-profile-comparison.html Will the Real sRGB Profile Please Stand Up?], analyzes the inconsistency among sRGB [[ICC profile]]s
* [https://ninedegreesbelow.com/photography/srgb-profile-comparison.html Will the Real sRGB Profile Please Stand Up?] by Elle Stone, which analyzes the inconsistency among sRGB [[ICC profile]]s
* [https://www.image-engineering.de/library/technotes/714-color-spaces-rec-709-vs-srgb Color spaces - REC.709 vs. sRGB] from image-engineering.de, with a graph comparing two transfer functions
* [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


{{Color space}}
{{Color space}}

Latest revision as of 17:36, 13 September 2024

sRGB
IEC 61966-2-1 Default RGB Colour Space - sRGB
sRGB colors situated at calculated position in CIE 1931 chromaticity diagram. Luminance set so that to avoid mach bands.
AbbreviationsRGB
StatusPublished
Year started1996
First publishedOctober 18, 1999; 24 years ago (1999-10-18)[1]
OrganizationIEC[1]
CommitteeTC/SC: TC 100/TA 2[1]
Base standardsIEC 61966 Colour Measurement and Management in Multimedia Systems and Equipment
DomainColor space, color model
Websitewebstore.iec.ch/publication/6169

sRGB is a standard RGB (red, green, blue) color space that HP and Microsoft created cooperatively in 1996 to use on monitors, printers, and the World Wide Web.[2] It was subsequently standardized by the International Electrotechnical Commission (IEC) as IEC 61966-2-1:1999.[1] sRGB 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.

sRGB essentially codifies the display specifications for the computer monitors in use at that time, which greatly aided its acceptance. sRGB uses the same color primaries and white point as ITU-R BT.709 standard for HDTV,[3] a transfer function (or gamma) compatible with the era's CRT displays, and a viewing environment designed to match typical home and office viewing conditions.

sRGB definition

[edit]

Gamut

[edit]
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, 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.[1]

Transfer function ("gamma")

[edit]
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)

The reference display characterisation is based on the characterisation in CIE 122. The reference display is characterised by a nominal power-law gamma of 2.2, which the sRGB working group determined was representative of the CRTs used with Windows operating systems at the time.[2] The ability to directly display sRGB images on a CRT without any lookup greatly helped sRGB's adoption.[citation needed] Gamma also usefully encodes more data near the black, which reduces visible noise and quantization artifacts.

The standard also defines a opto-electronic transfer function (OETF), which defines the conversion of linear light or signal intensity to a gamma-compressed image data. It is a piecewise compound function and has an approximate of 2.2, with a linear portion near zero to avoid an infinite slope which emphasizes signal (camera) noise.[4][5] Near zero, a power law curve intercepts a straight-line section that leads to zero.

In practice, there is still debate and confusion around whether sRGB data should be displayed with pure 2.2 gamma as defined in the standard, or with the inverse of the OETF. Some display manufacturers and calibrators use the former, while some use the latter. When a power law is used to display data that was intended to be displayed on displays that use the piecewise function, the result is that the shadow details will be "crushed" towards hard black.[6]

Computing the inverse opto-eletronic transfer function

[edit]

A straight line that passes through (0,0) is , and a gamma curve that passes through (1,1) is

If these are joined at the point (X,X/Φ) then:

To avoid a kink where the two segments meet, the derivatives must be equal at this point:

We now have two equations. If we take the two unknowns to be X and Φ then we can solve to give

The values A = 0.055 and Γ = 2.4 were chosen[how?] so the curve closely resembled the gamma-2.2 curve. This gives X ≈ 0.0392857, Φ ≈ 12.9232102. These values, rounded to X = 0.03928, Φ = 12.92321 sometimes describe sRGB conversion.[7]

Draft publications by sRGB's creators further rounded Φ = 12.92,[2] resulting in a small discontinuity in the curve. Some authors adopted these incorrect values, in part because the draft paper was freely available and the official IEC standard is behind a paywall.[8] For the standard, the rounded value of Φ was kept and X was recomputed as 0.04045 to make the curve continuous,[a] resulting in a slope discontinuity from 1/12.92 below the intersection to 1/12.70 above.

Viewing environment

[edit]
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.
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%

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 (D65). Using D50 for both would have made the white point of most photographic paper appear excessively blue.[10][11] 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 (i.e., dim, diffuse lighting) rather than the less-stringent typical viewing environment.[2]

Transformation

[edit]

From sRGB to CIE XYZ

[edit]

The sRGB component values , , are in the range 0 to 1. When represented digitally as 8-bit numbers, these color component values are in the range of 0 to 255, and should be divided (in a floating point representation) by 255 to convert to the range of 0 to 1.

where is , , or .

These gamma-expanded values (sometimes called "linear values" or "linear-light values") are multiplied by a matrix to obtain CIE XYZ (the matrix has infinite precision, any change in its values or adding non-zeroes is not allowed):

This is actually the matrix for BT.709 primaries, not just for sRGB, the second row corresponds to the BT.709-2 luma coefficients (BT.709-1 had a typo in these coefficients).

From CIE XYZ to sRGB

[edit]

The CIE XYZ 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 first step in the calculation of sRGB from CIE XYZ is a linear transformation, which may be carried out by a matrix multiplication. (The numerical values below match those in the official sRGB specification,[1][12] which corrected small rounding errors in the original publication[2] by sRGB's creators, and assume the 2° standard colorimetric observer for CIE XYZ.[2]) This matrix depends on the bitdepth.

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 .

These gamma-compressed values (sometimes called "non-linear values") are usually clipped to the 0 to 1 range. This clipping can be done before or after the gamma calculation, or done as part of converting to 8 bits. If values in the range 0 to 255 are required, e.g. for video display or 8-bit graphics, the usual technique is to multiply by 255 and round to an integer.

Usage

[edit]
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 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 is being labeled as sRGB, one can not conclude that the image is color-accurate sRGB.

If the color space of an image is unknown and it is an 8 bit image format, sRGB is usually the assumed default, in part because color spaces with a larger gamut need a higher bit depth to maintain a low color error rate (∆E). 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,[13] including variants for 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. 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.[13] Nevertheless, lookup tables are more commonly used as they are computationally more efficient.[citation needed] Even when parametric curves are used, software will often reduce to a run-time lookup table for efficient processing.[citation needed]

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. 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 (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 textures with sRGB gamma encoded color components (first introduced with EXT_texture_sRGB extension,[14] added to the core in OpenGL 2.1) and rendering into sRGB gamma encoded framebuffers (first introduced with EXT_framebuffer_sRGB extension,[15] 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.[16]

sYCC

[edit]

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. sYCC uses 8 bits for the components resulting in a range of approximately 0–1 for Y; -0.5–0.5 for C.[17] The amendment also contains a 10-bit-or-more encoding called bg-sRGB where 0–1 is mapped to -384510...639510, and bg-sYCC using the same number of bits for a range of approximately -0.75–1.25 for Y; -1–1 for C.[17]

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). This is also used by scRGB.

The amendment also recommends a higher-precision XYZ to sRGB matrix using seven decimal points, to more accurately invert the sRGB to XYZ matrix (which remains at the precision shown above):

.[17]

References

[edit]
  1. ^ The function is still very slightly non-continuous due to the prescribed value of "0.0031308" for toLinear(X). However, the discontinuity is too small to make a practical difference.[9]
  1. ^ a b c d e f "IEC 61966-2-1:1999". IEC Webstore. International Electrotechnical Commission. Retrieved 3 March 2017.
  2. ^ a b c d e f Michael Stokes; Matthew Anderson; Srinivasan Chandrasekar; Ricardo Motta (November 5, 1996). "A Standard Default Color Space for the Internet – sRGB, Version 1.10". Archived from the original on Jul 3, 2023.
  3. ^ Charles A. Poynton (2003). Digital Video and HDTV: Algorithms and Interfaces. Morgan Kaufmann. ISBN 1-55860-792-7.
  4. ^ Roberts, A. BBC RD 1991/6 Methods of Measuring and Calculating Display Transfer Characteristics (PDF) (Report). BBC. p. 1.
  5. ^ "The Importance of Terminology and sRGB Uncertainty". Colour Science. 2015-12-05. Retrieved 2021-11-05.
  6. ^ Siragusano, Daniele (July 17, 2020). "Colour Online: sRGB... We Need To Talk". FilmLight. Retrieved 2024-09-01.
  7. ^ Phil Green & Lindsay W. MacDonald (2002). Colour Engineering: Achieving Device Independent Colour. John Wiley and Sons. ISBN 0-471-48688-4.
  8. ^ Jon Y. Hardeberg (2001). Acquisition and Reproduction of Color Images: Colorimetric and Multispectral Approaches. Universal-Publishers.com. ISBN 1-58112-135-0.
  9. ^ Summers, Jason. "A close look at the sRGB formula". entropymine.com.
  10. ^ Rodney, Andrew (2005). Color Management for Photographers. Focal Press. p. 121. ISBN 978-0-240-80649-5.
  11. ^ "Why Calibrate Monitor to D65 When Light Booth is D50". X-Rite. Retrieved 2022-09-11.
  12. ^ "How to interpret the sRGB color space" (PDF). color.org. Retrieved 17 October 2017.
  13. ^ a b sRGB profiles, ICC
  14. ^ "EXT_texture_sRGB". 24 January 2007. Retrieved 12 May 2020.
  15. ^ "EXT_framebuffer_sRGB". 17 September 2010. Retrieved 12 May 2020.
  16. ^ "GPU Gems 3: Chapter 24. The Importance of Being Linear, section 24.4.1". NVIDIA Corporation. Retrieved 3 March 2017.
  17. ^ a b c "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". International Electrotechnical Commission. 2003.

Standards

[edit]
[edit]