The Luminance of an sRGB Color
This article presents a "compare and contrast" of the technology, standards, and color science behind the unadapted D65 sRGB color space and its counterpart, the D50 adapted sRGB ICC profile.
I started writing this article because I was irritated by the fact that the unadapted D65 Y values are passed along in blogs and user forums as the right Y values for calculating the luminance of an sRGB color, even when the context is an ICC profile color managed application. Along the way, the article transformed itself into an answer to the question "What is a reference white?
Written October 2013.
Formula for calculating the luminance of an sRGB color
Correctly calculating the luminance of an sRGB color is done in a linear gamma version of the sRGB color space, using the formula:
Luminance = R*Yr + G*Yg + B*Yb
where R", "G", and "B" refer to the color's RGB values, and Yr, Yg, and Yb are the respective "Y" values from the sRGB color space's Red, Blue, and Green XYZ primaries.
That would be all there is to say about calculating the luminance of an sRGB color, except that sRGB actually has two sets of Y values, because it has two different reference whites. In the context of an ICC profile color managed workflow, the reference white is D50. In the context of sending RGB values directly to a display device that's been calibrated to D65, with no intervening color management, the reference white is D65. As there are two reference whites, there are two sets of Y values.
The rest of this article unpacks this notion of two different reference whites for sRGB, with the goal of giving you first, a better understanding of how technology and standards have worked together to shape digital imaging, and second, a practical understanding of what a color space's "reference white" means in your digital darkroom.
Adapted and unadapted Y values
Table 1 shows sRGB Y values given by several acknowledged experts and authorities in the fields of color science and color management:
|D65 Unadapted||Adapted to D50||Source||Yr||Yg||Yb||Yr||Yg||Yb|
Why does sRGB have an unadapted and also an adapted set of Y values? The answer requires an understanding of what "adapted" and "reference white" mean in terms of everyday experiences.
What do "adapted" and "reference white" mean in everyday experiences?
Find a white object, for example white paper, PVC plastic or styrofoam. Take it outside on a very clear, preferably summer morning, when the sun is up but is still very close to the horizon. Stand with your back to the sun, hold the object up so it's fully illuminated by direct sunlight, and look at it. The "color of white" that you are looking at is roughly 5000K/D50, which is a relatively warm and yellow white. The higher in the sky the sun gets, and the more the light on your object is indirect rather than direct (eg on slightly or very overcast days), the higher the color temperature of the light. A mix of sunlight and indirect light on a slightly overcast day is roughly 6500K/D65, which is relatively speaking colder and bluer than the color of direct sunlight when the sun is close to the horizon.
I don't think there's a "D" illuminant for the color of light in deep shade on a bright sunny day. But if you take your white object into the deep shade cast by a (preferably neutral colored) building on a bright sunny day, the object will look blue, at least until your eyes adapt to the color of white in the deep shade, which can be 11000K and higher. If you keep glancing out at the full sunlight, your eyes won't have a chance to adapt to the color of white in deep shade. And if you hold the object so it's half in the shade, half in the full sunlight, the shade side will look blue no matter how long you stare at it because your eyes will remain adapted to the direct sunlight color of white.
Once your eyes have adapted to white light of a given temperature, a white object looks white, which is why you could use one of the old CRT monitors that might have had a color temperature anywhere between the very cold and blue 9300K to the relatively warmer and yellower 6500K and not think, "oh, the colors are too blue" or "my, the colors are more yellow than they ought to be".
When your eyes are adapted to a particular color of white, that color of white is your reference white, which is why deep shade looks blue when you are standing in sunlight looking into the shade.
Technology, standards, and reference white points
Standards by their very nature are dictated by the needs of major players in the industry and are based on technology that was in use at the time the standard was created. Hardly anyone uses CRTs anymore. But sRGB was created by Hewlett-Packard and Microsoft back in 1996, in the heyday of the CRT monitor, and so was designed to match the display characteristics of a CRT monitor that had been calibrated to have a D65 white point. So naturally sRGB has a D65 white point.
Hewlett-Packard and Microsoft didn't make sRGB up out of thin air. Rather it was based on Rec. 709, which "standardizes the format of high-definition television" and was first approved as a standard in 1990. Like sRGB, Rec. 709 uses the D65 white point.
The ICC was formed in 1993, three years after Rec. 709 was approved as a standard. At the risk of greatly oversimplifying the facts, the founding members of the ICC were:
- Two major manufacturers of film (Agfa and Kodak).
- Two major manufacturers of computers (Apple and Microsoft).
- The major software vendor (Adobe) that linked film, computers, and paper prints together to make digital files from scans of color film with the goal of making commercial color prints on paper stock.
The ICC chose D50 as the reference white for ICC profiles because it describes the appropriate viewing conditions for evaluating paper prints (see What is ISO 3664:2009? and the Introduction to the ICC Specification). However, there were and are several arguably logical alternative choices:
- D65 would have been a better fit to CRTs from the 1990s.
- D55 might have been a better fit to color film stock.
- E (equal energy) is the reference white for the 1931 CieXYZ reference color space and D55 is very close to E, so E itself would have been the mathematically simplest reference white.
- D60 is the color of white used by the new ACES color space and is close to the color temperature of today's LCD monitors. So if the ICC had invented ICC profiles in 2013, in a world that's moving to color-managed displays and digital prints, instead of 1993 when color prints meant paper prints, they might have picked D60 as the color of white.
When to use which Y values when calculating luminance
Expert advice is always a good place to start. So I'll quote what Charles Poynton, the actual sRGB specifications, the W3, and the ICC have to say about computing the luminance of an sRGB color. All the experts except the ICC use the D65 unadapted sRGB Y values, because for all the experts except the ICC, the context is sending RGB signals to a display device that's been calibrated to D65, in the absence of ICC profile color management.
Charles Poynton's 1997 ColorFAQ
For purposes of this article, sRGB and Rec. 709 are essentially the same thing. Question 9 of Poynton's Frequently Asked Questions about Color (ColorFAQ) says:
Contemporary CRT phosphors are standardized in Rec. 709 . . . The weights to compute true CIE luminance from linear red, green and blue (indicated without prime symbols), for the Rec. 709, are these:
Y709 = 0.2125R + 0.7154G + 0.0721B
For those of us (like myself) for whom "sRGB" has always meant the ICC D50-adapted sRGB profile, Poynton's Y values need both a historical and an application context. Color management is a relatively recent application of the principles of color science. The CIE, which is a kind of international clearing house for all things related to color science, was established in 1913. The CIE defined the CIE XYZ reference color space in 1931. The ICC, which is responsible for specifications governing color management via ICC profiles, wasn't established until 62 years later, in 1993. So there were color spaces defined in terms of the XYZ reference color space long before there were ICC profile color spaces, which are also defined in terms of the XYZ reference color space, but only use the D50 reference white.
Poynton wrote the ColorFAQ in March of 1997. The topic was how to accurately display digital images on display devices that were current in the 1990s (mostly CRTs, though flat panel televisions had already made an appearance), before anyone was using ICC profile color management. The only mention of color management in Poynton's ColorFAQ is at the very end. Questions 42 and 43 briefly describe what ICC profile color management is (or would become, when it was finally ready for actual use). Question 44 asks "Is a color management system useful for color specification?" Poynton's answer is "Not quite yet". Photoshop wouldn't be color managed until the release of Photoshop 5 in 1998 and home computers were still far too slow to handle on-the-fly ICC profile conversions. So in 1997 Poynton's statement that color management was "not quite yet" useful for color specification was an accurate assessment of the existing situation.
Poynton's ColorFAQ gives the unadapted sRGB Y values for calculating the luminance of an sRGB color. The application context is sending the correct RGB signals directly to a display that's been calibrated to or at least is reasonably close to D65. No white point adaptation was involved because color management wasn't being used, which means no ICC profiles were involved, which means there was no need to do any white point adaptation between the D65 display white point and the D50 ICC profile white point.
The 1996 Hewlett-Packard/Microsoft proposal that sRGB be the "Standard Default Color Space for the Internet"
The point of ICC profile based color management was (and is) to ensure accurate delivery and display of image colors throughout the chain of devices (eg film to scanner to monitor to printer to paper) that might handle a digitized image by means of various device profiles.
On the computers available in the 1990s, ICC profile based color management was computationally very expensive. But consumers did want to see nicer looking colors on their monitor screens. So in 1996, Hewlett-Packard/Microsoft proposed the sRGB color space as a way to eliminate the computing (and thinking!) overhead that was required by ICC profile based color management.
The section of the Hewlett-Packard/Microsoft proposal entitled "Colorimetric definitions and digital encodings" gives the sRGB "RGB to XYZ" matrix, the values for which are given in the unadapted columns of Table 2. The Y values from the sRGB-to-XYZ matrix are (0.2126, 0.7152, 0.0722), almost exactly the same as the values in Poynton's ColorFAQ, which is only reasonable as Poynton was one of the color science and display technology experts who helped shape sRGB (see the Acknowledgements at the bottom of the Hewlett-Packard/Microsoft proposal; despite its technical nature, the entire proposal is well worth reading).
As the point of the Hewlett-Packard/Microsoft proposal was to eliminate the overhead incurred by ICC profile based color management, their proposal used the unadapted, D65 sRGB-to-XYZ primaries and hence the unadapted Y values.
The 2008 W3 (World Wide Web Consortium) WCAG guidelines for calculating luminance
The W3 sets standards for the Web. One such standard, the Web Content Accessibility Guidelines (WCAG), gives guidelines for the minimum contrast ratio for readability, expressed using the ratio of the relative luminance of text and background colors. The Guidelines says:
Note 1: For the sRGB colorspace, the relative luminance of a color is defined as L=0.2126×R+0.7152×G+0.0722×B" . . .
Note 2: Almost all systems used today to view Web content assume sRGB encoding. Unless it is known that another color space will be used to process and display the content, authors should evaluate using sRGB colorspace.
Again referring to Table 1, the W3 uses the unadapted sRGB Y values to calculate luminance. Presumably the W3 knows the difference between using and not using color management, and so in accordance with Hewlett-Packard and Microsoft's goal of eliminating the need for color management for the World Wide Web, the W3 formula for calculating luminance uses the unadapted sRGB primaries.
The ICC (International Color Consortium) "Specification of sRGB"
As already stated, RGB-to-XYZ values for a color space must be adapted to use the D50 reference white before the resulting color space profile can be used in an ICC profile color managed workflow. Under "Hints for Profile makers [sic]" the ICC Specification of sRGB says:
When chromatically adapted to the D50 white point, using the recommended 'Bradford' chromatic adaptation matrix published on the ICC web site, and normalised such that Y=1 for white, the tristimulus values of the [sRGB] primaries and white are:R: X=0.4360, Y=0.2225, Z=0.0139; G: X=0.3851, Y=0.7169, Z=0.09710; B: X=0.1431, Y=0.0606, Z=0.7139
So an ICC sRGB color space profile uses the adapted Y (and X and Z) values and the context for these adapted values is an ICC profile color managed workflow. However, the ICC "Specification of sRGB" doesn't give explicit advice on how to calculate the luminance of an sRGB color in an ICC profile color managed workflow.
Color science and luminance
In a non-color-managed context, when sending signals directly to a nominally D65 display device, expert advice is clear and consistent: use the unadapted D65 sRGB color space and Y values. I haven't found posted on the internet any expert advice or authoritative statement explicitly stating how to calculate the luminance of an sRGB image in an ICC profile color managed workflow. However, the ICC specifies that sRGB profiles used in a color managed workflow must be adapted to D50. So the question is, what does "adapted to D50" mean?
Two sRGB matrices: unadapted and adapted
When defining a matrix RGB color space, in addition to Y values for Red, Blue, and Green, you also need X and Z values. The D65 unadapted and the D50-adapted sRGB color spaces are both defined by their respective RGB to XYZ matrices. Table 1 shows the unadapted and adapted sRGB to XYZ matrices. The D65 unadapted values are from the 1996 Hewlett-Packard/Microsoft proposal, A Standard Default Color Space for the Internet - sRGB. The D50 adapted values are from the ICC's Specification of sRGB:
|D65 Unadapted||D50 Adapted||X||Y||Z||X||Y||Z|
Y from XYZ is luminance
The luminance of an sRGB color is calculated in a linear gamma version of the sRGB color space, using the formula:
Luminance = R*Yr + G*Yg + B*Yb
where R", "G", and "B" refer to the color's RGB values, and Yr, Yg, and Yb are the respective "Y" values from the sRGB color space's Red, Blue, and Green XYZ primaries.
If you use this formula to calculate the luminance of the reddest red, greenest green, and bluest blue unadapted and adapted sRGB colors, you end up with, respectively, the red, green, and blue Y values for the unadapted and adapted sRGB RGB to XYZ matrices shown in Table 1 above. Here are the actual calculations:
Unadapted: Red: (255*0.2126 + 0*0.7152 + 0*0.0722) / 255 = 0.2126 Green: ( 0*0.2126 + 255*0.7152 + 0*0.0722) / 255 = 0.7152 Blue: ( 0*0.2126 + 0*0.7152 + 255*0.0722) / 255 = 0.0722 Adapted: Red: (255*0.2225 + 0*0.7169 + 0*0.0606) / 255 = 0.2225 Green: ( 0*0.2225 + 255*0.7169 + 0*0.0606) / 255 = 0.7169 Blue: ( 0*0.2225 + 0*0.7169 + 255*0.0606) / 255 = 0.0606
This "coincidence" of a color's calculated luminance and a color's corresponding XYZ Y value happens to be true for all colors in any RGB color space, because it's not really a coincidence but rather is contained in the mathematical relationship between RGB and XYZ. The Wikipedia article on relative Luminance (referenced in Section B above) says:
For color spaces such as XYZ, xyY, etc. the letter Y refers to relative luminance. No computation is required to find relative luminance when it is explicit in a color representation in such spaces.
Acquiring an intuitive, much less mathematical, understanding of "why" (pun intended) luminance equals "Y" in the XYZ and xyY reference color spaces might take you farther into color science than you might want to go. But one important reason why color scientists created the XYZ reference color space was precisely so that Y would be equal to relative luminance. X and Z carry information about how the cones in the human eye respond to light waves of different colors. Because of the "opponent" nature of how the eye and brain create color from light, Y also carries color information. The mathematically related xyY color space cleanly separates relative luminance and color information, called "chromaticity". If you'd like to know more about the equivalence of Y and luminance and why the color scientists wanted Y to be luminance, read the Wikipedia article CIE 1931 color space several times over and start following the links for more information. Also read The CIE XYZ and xyY Color Spaces, and for good measure read Color: the 1931 CIE color-matching functions and chromaticity chart.
Comparing Y from XYZ and Y from the formula for luminance
The argyllcms xicclu utility makes it very easy to convert a color in any RGB color space to its equivalent XYZ coordinates, as long as you have an actual ICC profile for the color space:
Here's the xicclu command: $ xicclu -ir -px -s255 linear-gamma-version-of-argyllcms-sRGB.icm To get the xicclu output, type in the RGB values you are interested in. Sample RGB input values and XYZ output are shown below: (white) 255 255 255 [RGB] -> 0.964203 1.000000 0.824905 [XYZ] (reddest red) 255 0 0 [RGB] -> 0.436035 0.222443 0.013901 [XYZ] (greenest green) 0 255 0 [RGB] -> 0.385101 0.716934 0.097076 [XYZ] (bluest blue) 0 0 255 [RGB] -> 0.143066 0.060623 0.713928 [XYZ] (black) 0 0 0 [RGB] -> 0.000000 0.000000 0.000000 [XYZ]
Comparing the xicclu Y values in the above code box to the Y values that were calculated for the D50 adapted sRGB in the code box in Section A2, as expected, they match. Notice that the xicclu output XYZ values for the reddest red, greenest green, and bluest blue closely match the XYZ values for the D50-adapted sRGB ICC profile shown in Table 1 above. Typing in the RGB values for the reddest red, greenest green, and bluest blue colors (in any matrix RGB color space, not just sRGB) will always return the corresponding XYZ primaries, because that's (part of, you also need the white point and the black point) how an RGB matrix color space is specified: by giving the location in XYZ space of the color space's reddest red, greenest green, and bluest blue colors. So if you have an ICC profile, the xicclu utility can be used to ascertain the right Y values for calculating luminance.
When using xicclu, you actually don't need to use a linear gamma version of the sRGB profile to get the right XYZ (and hence Y) values, because xicclu takes the profile tone response curve (TRC) into account for you and gives you the right results.
But when using the formula for calculating the luminance of a color in an sRGB image, you must use the linear gamma RGB values. Otherwise the results are wrong for all RGB values, except the values for white, reddest red, greenest green, bluest blue, and black (think about it and you'll realize why this is true; better yet, experiment with xicclu until you are convinced it's true).
This article is a work in progress . . .
In theory, there is no privileged reference white. In practice, there is a range of reasonable reference whites determined by actual light sources available in our environment.
According to Wikipedia, luminance is a measure of how bright a color or object appears to be when you look at it. When measuring luminance in the real world:
Luminance is a photometric measure of the luminous intensity per unit area of light travelling in a given direction.
In the digital darkroom, luminance means relative luminance, which is photometric luminance normalized to a specified reference white.