Juan Cesar Jover ( Apratizando ) has very kindly made a Spanish translation of the February 2013 version of this Completely Painless Programmer's Guide. I've made some mostly minor changes to the text since then.

This tutorial was written in the hope that it might be of use to technically savvy people who know a whole lot about the code and the mathematics that goes into making an image editing program, but perhaps not so much about color spaces and ICC profiles.

Written October 2013. Updated February 2015.

All RGB, XYZ, and yxY numbers in this tutorial are floating point numbers. RGB numbers have the nominal range 0 to 1, as does Y from XYZ and xyY. Nominal ranges are often extended in practice.

Color

On the one hand, light comes from the sun or other radiant sources, and is refracted by mediums (water, the atmosphere, glass) and diffusely or specularly reflected by surfaces. On the other hand, color isn't out there in the world in the same tangible way that light is. Rather color is part of how we sense the world around us. Light enters the eyes, is processed by light receptors (cones and rods), and sent via the optic nerves to the brain for further processing and interpretation. Light varies in wavelengths, which our eyes and brain interpret as varying colors, and also in intensity. So our perception of color is composed of both intensity information and chromaticity information. The naming of colors carries one out of the narrow realm of color perception, and into the larger realm of cultural and linguistic interpretation and classification of color, and thence into even larger philosophical, aesthetic, theological, and metaphysical considerations.

XYZ Color mapping experiments: what the average human sees In the late 1920s William David Wright and John Guild independently conducted a series of color matching experiments that mapped out all the colors the average human (meaning the average of the humans in the experiments) can see. In 1931 color scientists used the results of the Wright and Guild experiments to create the 1931 CIEXYZ color space ("XYZ" for short). Visualizing XYZ To visualize XYZ, think of a three-dimensional cartesian coordinate system (high school algebra) with axes labelled X, Y, and Z. In the XYZ color space, Y corresponds to relative luminance; Y also carries color information related to the eye's "M" (yellow-green) cone response. X and Z carry additional information about how the cones in the human eye respond to light waves of varying frequencies. Real colors and imaginary colors Theoretically, the XYZ axes go off to infinity in both the positive and negative direction. However, not every set of coordinates in XYZ space corresponds to a color that the average human can see. XYZ coordinates that are outside the locus of colors mapped by the color matching experiments that led to the creation of the XYZ color space are called imaginary colors. XYZ coordinates that are inside the locus of colors mapped by the color matching experiments are called real colors. Colors that weren't measured Not every being sees color exactly like the hypothetical average human. For example, birds, bees, dogs, and humans with nonstandard color perception don't see the same colors in the same way as the average human. However, for purposes of the digital darkroom, the colors that are seen by any being with non-standard color perception are neither real nor imaginary. Here's why: As mentioned in the first section of this article, light waves of different frequencies are out there in the world, but color happens in the eye and brain. One could do (and I'm sure color scientists have done) color matching experiments with human tetrachromats, with color-blind humans, and perhaps even with birds, bees, dogs, and etc. But the resulting "tetrachromat-XYZ" color space (or "color-blind-XYZ" color space, or "bird-XYZ" color space) wouldn't be the same as the "average humans only" 1931 CIEXYZ color space. These alternative color spaces would have their own sets of real and imaginary colors. To summarize, if a flower reflects it ("it" being that complex phenomenon we call light) and a bee sees it, of course it's real for the bee. And if a painting reflects it and a human tetrachromat sees it, it's real for the tetrachromat. But as far as the 1931 CIEXYZ color space that we use in the digital darkroom is concerned, these "nonstandard color perception" colors aren't real and aren't imaginary, rather they simply weren't measured during the color matching experiments that led to the creation of the XYZ color space. Who's average? I don't know the composition of the humans that participates in the color matching experiments that led to the creation of the "average human" 1931 CIEXYZ color space, but if I had to guess, I would guess that they were healthy young adult British males. It amazes me that despite the somewhat limited experimental foundations of the XYZ color space (since supplemented with additional experiments), XYZ is nonetheless extremely useful. In fact, though seldom used directly in image editing, the XYZ color space is the basis of everything that relates to color in a color-managed image editing application.

RGB from XYZ The various RGB color spaces that we use in the digital darkroom are simply useful subsets of all the colors contained in the XYZ color space. How to specify an RGB matrix color space The simplest type of RGB color space, which is also the type of RGB color space that we use for normal image editing, is an RGB matrix color space. An RGB matrix color space is defined by specifying the XYZ coordinates for five colors, those being the color space's: Darkest dark color ("black")

Lightest light color ("white")

Reddest red color

Greenest green color

Bluest blue color The five XYZ coordinates that define an RGB matrix color space in XYZ space have names that are a little easier to say than phrases like "darkest possible dark", lightest possible light", and so on: The XYZ coordinates for the darkest dark is called the color space's black point .

. The XYZ coordinates for the lightest light is called the color space's white point .

. The XYZ coordinates for the reddest possible red, greenest possible green and bluest possible blue are called the color space's Red, Green, and Blue primaries . What is black? What is white? We have an intuitive sense that "black" and "white" only have one meaning each. But as far as specifying a particular RGB matrix color space goes, the only requirement is that the Y coordinate for the RGB color "white" is greater than the Y coordinate for the RGB color "black". For example, for a printer profile , the XYZ coordinates for "black" might represent a real color that in ordinary terms we might call dark blue-gray or dark yellow-gray, depending on the printer inks. And the XYZ coordinates for white might represent a real color that in ordinary terms we might call bluish off-white or eggshell off-white, depending on the base color of the printer paper. (As an aside, most printer profiles are LUT rather than matrix profiles, but LUT profiles still have black and white points.) Eight vertices from five coordinates It only takes five XYZ coordinates to define an RGB matrix color space, those being the XYZ coordinates for the five RGB colors black, reddest red, bluest blue, greenest green, and white. However, the resulting shape in XYZ space isn't a pyramid (5 vertices, 4 sides), but rather a hexahedron (8 vertices, 6 sides), with the following eight XYZ coordinates as vertices: The XYZ coordinate for the RGB color (0,0,0) or the darkest possible RGB dark ("black"). The XYZ coordinate for the RGB color (1,1,1) or the lightest possible RGB light ("white"). The XYZ coordinate for the RGB color (1,0,0) or the reddest RGB red. The XYZ coordinate for the RGB color (0,1,0) or the greenest RGB green The XYZ coordinate for the RGB color (0,0,1) or the bluest RGB blue The XYZ coordinate for the RGB color (1,0,1) or the most magenta possible RGB magenta. The XYZ coordinate for the RGB color (1,1,0) or the yellowest possible RGB yellow. The XYZ coordinate for the RGB color (0,1,1) or the most cyan possible RGB cyan. How do you get 8 XYZ vertices by specifying only five XYZ coordinates? Light is additive. So once you know the XYZ locations of the red, blue, and green primaries, add red and blue to get magenta, add red and green to get yellow, and add blue and green to get cyan. An infinite number of RGB color spaces, or, "What is red?" People who've been around since the beginning of digital imaging sometimes tend to unconsiously assume that "RGB" means "sRGB", even if consciously they know otherwise. But actually there are an infinite number of possible RGB matrix color spaces, and the physical (real world) meaning of "reddest red", "greenest green", and "bluest blue" depends on which XYZ coordinates you pick for an RGB color space's primaries. Let's say you want to make two different RGB matrix color spaces, LargeRGB and SmallRGB. The reddest possible red in LargeRGB has the RGB coordinates (1,0,0). The reddest possible red in SmallRGB also has the RGB coordinates (1,0,0). But the meaning of (1,0,0) in LargeRGB is not the same as the meaning of (1,0,0) in SmallRGB, because the two color spaces have different red primaries, which means different XYZ coordinates that corresond to their respective RGB color (1,0,0). This is why people say RGB is relative to XYZ. I haven't yet introduced xyY space (see Section D below). But unlike XYZ, xyY space cleanly separates the XYZ Y (luminance) from color, or rather from chromaticity , which is what the "xy" in xyY stands for. So in xyY space you can plot "color" (really, chromaticity) on a 2D diagram. Figure 1 shows the xy chromaticity coordinates for the red, blue, and green primaries for the relatively small sRGB and the larger WideGamutRGB color spaces, providing a visual counterpart to the often-repeated claim that "RGB is relative to XYZ" (and hence also relative to xyY): xy chromaticity coordinates for the sRGB and WideGamutRGB red, green, and blue primaries. What color is Red? Green? Blue? It depends on the location of the defining RGB color space's XYZ/xyY coordinates: The reddest possible sRGB red is more orange and less saturated than the reddest possible WideGamut red.

The greenest possible sRGB green is considerably more yellow and much less saturated than the greenest possible WideGamut green.

Compared to the bluest possible sRGB blue, the bluest possible WideGamut blue is more of a violet blue and also more saturated. The above chromaticity diagram (without the superimposed sRGB and WideGamutRGB color space primaries) is a public domain chromaticity diagram from Wikipedia. A two-dimensional xy diagram can't really convey an intuitive sense of different three-dimensional RGB color spaces inside the XYZ reference color space. Experimenting with Bruce Lindbloom's 3D Gamut Viewer (towards the bottom of his RGB Working Space Information) is the quickest way to acquire an intuitive feel for the relationship between the XYZ reference color space and differently sized and shaped RGB color spaces. I strongly encourage you to vist Bruce Lindbloom's website and spend a few minutes examining various RGB color spaces inside the XYZ reference color space. For example, using the 3D Gamut Viewer, pick the 'WideGamut' color space as the Primary Working Space, 'None' as the Secondary Working Space, and 'XYZ' as the (reference) Color Space. The Gamut Viewer is interactive so you can swing the XYZ color space around and view the Primary Working Space from all angles. Also try switching to xyY space. See if you can locate all 8 XYZ vertices (black, white, red, blue, green, magenta, cyan, white). Then add 'sRGB' as the Secondary Working Space and see how the WideGamut color space compares to the sRGB color space.

xyY and the chromaticity diagram The horseshoe-shaped chromaticity diagram that you are no doubt familiar with is a kind of "footprint" of all real colors on the xy (chromaticity) plane of the xyY color space. xyY from XYZ xyY is calculated from XYZ by surprisingly simple mathematical equations: x = X / (X+Y+Z) y = Y / (X+Y+Z) Y = Y Unlike XYZ, xyY space cleanly separates the XYZ Y (luminance) from color, or rather from chromaticity, which is what the "xy" in xyY stands for. For more details see The CIE XYZ and xyY Color Spaces, and Bruce Lindbloom's xyY to XYZ, and XYZ to xyY. The outer edge of the horseshoe-shape corresponds to various spectrally pure wavelengths of actual light that humans can see, which is why I said XYZ and xyY are connected by "surprisingly" simple equations: it surprises me that XYZ values are so easily connected with wavelengths of actual light. But then again, the wavelengths of light used in Guild and Wright experiments were there before the xyY and XYZ color spaces had been invented to describe them. All XYZ colors have unique locations in xyY space and vice versa, so like XYZ, xyY is also a reference color space. The "xy" part of xyY represents color (actually "chromaticity", which is what's left of color when luminance is abstracted away) and the "Y" represents relative luminance. If you examine the equations for calculating xyY from XYZ and vice versa, you will see that the "Y" of xyY and the "Y" of XYZ are equal to one another, so both of them represent the relative luminance of a color. RGB color space coordinates in xyY space Table 2 is exactly the same as Table 1 , except that instead of giving the locations of the ICC profile color space coordinates in XYZ space, now the locations are given in xyY space: Table 2: D50-adapted RGB working space primaries (xyY) Red Green Blue x y Y x y Y x y Y sRGB (D65) 0.6485 0.3308 0.2224 0.3212 0.5978 0.7170 0.1559 0.0660 0.0606 CIE-RGB (E) 0.7346 0.2665 0.1699 0.2811 0.7077 0.8242 0.1706 0.0059 0.0059 ProPhotoRGB 0.7347 0.2653 0.2880 0.1596 0.8404 0.7120 0.0366 0.0000 0.0000 AllColors-RGB 0.7347 0.2653 0.3482 0.0000 1.0000 0.7100 0.0000 -0.0759 -0.0582 Identity 1.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000 Some of the primaries in Tables 1 and 2 are highlighted in yellow. The highlighted primaries represent XYZ (and hence xyY) coordinates that aren't real colors. The bluest blue and greenest green in the ProPhotoRGB, AllColors-RGB, and Identity color spaces are imaginary colors, as is the reddest red in the Identity color space. Figure 2 below shows why these colors aren't real colors — they fall outside the horseshoe-shaped chromaticity diagram. Black, white, red, blue, and green on the chromaticity diagram Figure 2 shows you the xy Red, Blue, and Green chromaticity coordinates corresponding to the RGB color space "xy" coordinates in Table 1. The brightly colored horseshoe shape in Figure 2 is the chromaticity diagram, shows you all the xy coordinates that represent real colors. All xy point outside the chromaticity diagram represent imaginary colors. Showing you the actual xyY (or XYZ) coordinates would require a preferable interactive 3D representation. The outer edge of the chromaticity diagram represents spectrally pure colors identified by their wavelengths. The blue numbers around the edges of the brightly colored "horseshoe" are different wavelengths of spectrally pure light specified in nanometers. For example, the reddest red has a wavelength of 700 nm, the greenest greens are up around 520 nm, and the bluest blues are down around 450nm. Below 450nm are the violet blues, and oddly enough, all the magenta colors between violet-blue at 380 nm and red at 700 nm are purely a construct of the human brain, with no corresponding real wavelengths of light. Light waves are out there in the world, but color happens in the interaction between light waves and the eye, brain, and mind. Chromaticity (xy) coordinates for the sRGB, CIE-RGB, ProPhotoRGB, AllColors-RGB, and IdentityRGB color spaces. All chromaticity values that fall outside the horseshoe shape created by spectrally pure colors are imaginary colors, colors that humans can't actually see. Any color space large enough to include all real colors, also includes imaginary colors. The triangle defined by a color space's chromaticity coordinates (the large black, cyan, magenta, green, and blue dots) marks the boundaries of the most intense, pure, saturated colors that particular color space can hold. Anything outside the triangle is "out of gamut" with respect to that color space. The sRGB triangle (the lines connecting the black dots) shows that many real colors are out of gamut with respect to the sRGB color space. Many image editing applications require the ability to specify colors that fall outside the sRGB color gamut, which is why there's more than one RGB working color space. CIE-RGB, which is the very first RGB color space ever invented, is shown by the cyan dots and lines. The most commonly used large ICC working space profile is ProPhotoRGB, shown by the magenta dots and lines. The green dots and lines show the ACES/AllColors color space, and the blue dots and lines show the (largest and also mathematically simplest) Identity color space. In the diagram, the blue line for the Identity color space connecting (0,0) to (0,1) is hidden by the corresponding green line for the ACES/AllColors color space; likewise a portion of the blue line connecting (1,0) to (0,1) for the Identity color space is hidden by the corresponding green line for the ACES/AllColors color space. The x and y axes of the xyY color space extend on to infinity in both the positive and negative directions. The xy axes in Figure 2 stop at 0.9 and 0.8 because I used a public domain chromaticity diagram from Wikipedia rather than drawing my own diagram from scratch, and the x and y axes don't need to go any farther than 0.8 and 0.9 to accomodate the chromaticity of all real colors. As already noted, the color of black in an ICC matrix RGB working color space has the XYZ coordinates (0.0000, 0.0000, 0.0000) and the color white has the XYZ coordinates (0.9642, 1.0000, 0.8249). The corresponding black and white xyY coordinates are (0.3805, 0.3769, 0.0000) and (0.3805, 0.3769, 1.0000). If you mentally locate these points on the chromaticity diagram in Figure 2 above, it should be clear that black and white are located just about dead center in the middle of the chromaticity diagram. "All the real colors" requires imaginary colors, too The largest RGB working space that uses only real colors as its primaries is the WideGamutRGB color space (shown in Figure 1 in Section B), which uses three spectrally pure colors located at 700, 525, and 450 nanometers as its primaries. If you mentally draw lines on the chromaticity diagram connecting the 700nm, 525nm, and 450nm wavelengths of light on the chromaticity diagram (or refer back to Figure 1 ), it should be obvious that WideGamutRGB doesn't include all the real colors. There's a swath of greens and cyans, plus a swath of violet blues and magentas that are left out. Moving the blue primary down to 380nm would include the violet blues and magentas, but a whole lot more of the greens and cyans would be left out. Unfortunately, it's impossible to pick three dots anywhere inside or on the edge of the horseshoe-shaped chromaticity diagram that can be connected to encompass the entire horseshoe. The easiest and most mathematically obvious way to get "all the colors" is the Identity profile, with chromaticity coordinates (1,0), (0,1), and (0,0), all of which fall outside the chromaticity diagram and hence represent imaginary colors. The ACES/AllColors color space chromaticity coordinates are also mathematically obvious: Draw a straight line from the chromaticity coordinates for the reddest real red at 700nm, straight up to the (imaginary) coordinates (0,1) for the green primary. Draw a second line from the chromaticity coordinates for the reddest real red, through the coordinates for the bluest real (violet) blue at 380nm. Use high school algebra to calculate the slope and Y intersect, which is at the (imaginary) coordinates (x=0.0, y=-0.6). The Identity color space and the ACES/AllColors color space both include all the real colors. Looking at the chromaticity diagram, it should be obvious that the ACES/AllColors color space is more efficient than the Identity color space, meaning it includes a lower percentage of imaginary colors. Notice that the CIE-RGB, ProPhotoRGB, and ACES/AllColors-RGB color spaces all have (almost) the same Reddest Red chromaticity coordinates. Several other standard color spaces also use these same Reddest (real! not imaginary) Red chromaticity coordinates, including BestRGB and WideGamutRGB (the Y values vary, so the XYZ coordinates are not identical, just the xy chromaticity coordinates). Moving on to the last topic covered in this tutorial, there's one more bit of information you need before you can make and use an ICC matrix RGB color space profile in a color managed work flow, and that's the color space profile's tone response curves , covered in Section F:

TRCs and perceptual uniformity Perceptual uniformity in (not so) everyday experiences Here's a thought experiment that might help demonstrate what perceptual uniformity means from an everyday point of view: Pretend that you are in a room. There are no windows and the light-tight door is shut and locked. The room has 25 ten-watt light bulbs, all grouped closely together and attached to the ceiling. The ceiling is low enough and the room is small enough that 255 watts of light makes the room reasonably bright, but large enough that 10 watts of light hardly lights the room at all. Now imagine that none of the light bulbs are turned on, so the room is completely dark.You have a document in your hand that you need to read because it tells you how to unlock the door and get out of the room. So once you locate the first light switch (there are 25 light switches, too, and unfortunately they aren't all in one place), you start turning on light bulbs. That first light bulb makes a big difference (some light vs no light). But depending on how far away the ceiling is, you probably can't read the document yet, because light intensity falls off as the square of the distance from the light source. Turning on the second light bulb makes things look perhaps twice as bright, because humans are very sensitive to minor changes in light when the light level is very low. Turning on the third light bulb makes things look still brighter, but not three times brighter than just turning on one light bulb. The reason is because the more the photometric luminance increases, the less of a perceptual difference a small "unit of change" makes. We can easily tell the difference betweeen two lit 10-watt light bulb vs three lit 10-watt light bulbs, in our hypthetical "small enough" locked room, but not between 24 and 25 lit 10-watt light bulbs. To summarize the results of our thought experiment, our perception of changes in luminance isn't linear, which means linear increments of additional light doesn't mean linear increments of our perception of the brightness of light. When the light level is low, "one more bulb" makes a big perceptual difference. When the light level is high enough, "one more bulb" makes essentially no perceptual difference at all. (As an exercise, try connecting the results of this "thought experiment" with the TRC and xicclu graphs in Figure 3 below.) What is a tone response curve? Switching gears rather abruptly here, in an ICC profile, a tone response curve ("TRC") determines how fast a color goes from dark to light as the color's RGB values go from 0 to 1. Some TRCs are linear. Some TRCs are more or less perceptually uniform. As an important aside, this document uses the phrase "tone response curve" and this phrase is accepted terminology. However you will also see the phrase "tone reproduction curve", which is also accepted terminology, and more widely used (even on this website) than the phrase "tone response curve". Fortunately both phrases have the same "TRC" acronym. There are actually three TRC tags in an ICC profile, one each for the Red, Blue, and Green channels. Theoretically each channel of an RGB ICC profile can have its own TRC that doesn't match the TRCs in the other two channels. This is commonly done with look profiles that are intended to make an image "look prettier" by virtue of simply applying an ICC profile. But for the well behaved RGB matrix ICC profiles that we use for image editing in the digital darkroom, all three channels have exactly the same tone response curve. Commonly used TRCs Although there are an infinite number of possible ICC profile tone response curves, only a few have found widespread use in working space ICC profiles: The linear gamma TRC is mathematically simple (value in =value out ). There is no one single "linear light RGB" color space. Any RGB color space can be made into a "linear light" color space simply by giving it a linear gamma TRC in place of its regular TRC, hence linear light sRGB, linear light ProPhotoRGB, linear light Identity, etc. So "linear light RGB" or "linear gamma RGB" doesn't tell you which linear gamma RGB color space, it only tells you that the color space in question has a linear gamma tone response curve. The ACES color space is the only widely used color space that has a linear gamma TRC by design.

is mathematically simple (value =value ). There is no one single "linear light RGB" color space. Any RGB color space can be made into a "linear light" color space simply by giving it a linear gamma TRC in place of its regular TRC, hence linear light sRGB, linear light ProPhotoRGB, linear light Identity, etc. So "linear light RGB" or "linear gamma RGB" doesn't tell you which linear gamma RGB color space, it only tells you that the color space in question has a linear gamma tone response curve. The ACES color space is the only widely used color space that has a linear gamma TRC by design. Other "true gamma" curves . Besides the linear gamma TRC, two other commonly used "true gamma" TRCs are gamma=1.80 (for example, AppleRGB, ColorMatchRGB, and ProPhotoRGB), and gamma=2.2 (for example, AdobeRGB, BetaRGB, and WideGamutRGB). A gamma=2.2 TRC is the closest to being perceptually uniform. The gamma=2.0 TRC is the mathematically simplest nonlinear TRC.

. Besides the linear gamma TRC, two other commonly used "true gamma" TRCs are gamma=1.80 (for example, AppleRGB, ColorMatchRGB, and ProPhotoRGB), and gamma=2.2 (for example, AdobeRGB, BetaRGB, and WideGamutRGB). A gamma=2.2 TRC is the closest to being perceptually uniform. The gamma=2.0 TRC is the mathematically simplest nonlinear TRC. The mathematically inconvenient sRGB TRC is composed of a small linear segment (in the shadows) grafted onto a gamma=2.4 curve (everywhere else). The sRGB TRC is also close to being perceptually uniform and is approximately equal to the mathematically much simpler true gamma=2.20 TRC.

is composed of a small linear segment (in the shadows) grafted onto a gamma=2.4 curve (everywhere else). The sRGB TRC is also close to being perceptually uniform and is approximately equal to the mathematically much simpler true gamma=2.20 TRC. The "L-star" curve is a perceptually uniform tone response curve based on the CieLAB L* channel. The L-star curve is used in the ECI-RGB color space. The L-star TRC is also mathematically inconvenient, relying as it does on the L* Companding equations. Tone response curves and xicclu graphs Figure 3 compares the linear gamma TRC with the exactly perceptually uniform L-star TRC and the approximately perceptually uniform sRGB TRC: Three profile tone response curves and their xicclu graphs: Top row: the linear gamma TRC. Middle row: the sRGB-TRC. Bottom row: the perceptually uniform L-star TRC. For each row in Figure 3 , the left side is the actual profile TRC contained in the ICC profile TRC tags, as revealed by the ICC Profile Inspector, and the right side is the corresponding xicclu graph showing how fast the colors go from black to white along the profile's grayscale axis, compared to the perceptually uniform L* curve. The xicclu graph is reversed from what you might expect — white is in the upper left corner and black is in the lower right corner. The profile TRC scale runs from 0 to 65535 and the xicclu scale runs from 0 to 100. So the mid-point of the profile TRC is 32767 and the mid-point of the xicclu curve is 50. The green dots divide each profile TRC and xicclu graph into quarters along the vertical scale, so you can visually compare the rate of change of the profile TRCs on the left with the corresponding rate of change in the xicclu curve on the right. How to interpret profile TRCs and their xicclu graphs: A xicclu graph is a straight line if and only if the corresponding profile TRC results in a perceptually uniform rate of change in the lightness (L*) of the color as the RGB numbers increase from 0 to max white. Looking at the graphs in the top row, the linear gamma TRC (left side) is a straight line, which reflects the way light actually behaves, but its xicclu curve (right side) is deeply curved, which means the distribution of tonality from black to white is not perceptually uniform. Looking at the graphs in the bottom row, the perceptually uniform TRC (left side) is deeply curved and does not reflect how light actually behaves, but its xicclu curve (right side) is a straight line, which means the distribution of tonality from black to white is perceptually uniform. The sRGB TRC (middle row) xicclu graph isn't quite a straight line, which means the sRGB TRC is only approximately perceptually uniform. The gamma=2.2 TRC and xicclu graph (not shown in Figure 3) are very similar to the sRGB TRC and xicclu graph. The main "take away" points from Figure 3 above are: A linear gamma TRC represents the way real light in the real world actually combines and changes, which is to say, linearly — twice the light, twice the luminance (Y of xyY and XYZ). But the rate of change is perceptually very uneven.

— twice the light, twice the luminance (Y of xyY and XYZ). But the rate of change is perceptually very uneven. The L-star TRC is exactly perceptually uniform and the sRGB TRC (and also the gamma=2.2 TRC) is approximately perceptually uniform. A perceptually uniform rate of change require a very nonlinear TRC and does not represent the way real light behaves. If light is linear, why do so many familiar RGB color spaces use (approximately) perceptually uniform TRCs? The main reason so many familiar RGB color spaces use approximately or exactly perceptually uniform TRCs has to do with a little problem called posterization that plagues 8-bit image editing. Some background is required to explain what posterization is. Figure 4 compares three gradients, created respectively with the linear gamma TRC, the almost perceptually uniform sRGB TRC, and the perceptually uniform l-star TRC: Three black to white gradients: Top row: the gradient you get when using an ICC profile working space that has the linear gamma tone response curve. Middle row: the gradient you get when using an ICC profile working space that has the regular ICC sRGB color space profile with its almost perceptually uniform sRGB tone response curve. Bottom row: gradient you get when using an ICC profile working space that has the perceptually uniform l-star tone response curve. As you can see by looking at the linear gamma gradient in the top row of Figure 4 , a linear gamma gradient distributes tone steps very unevenly. By "tone steps" I mean how many gradations are available to get from black to white. In an 8-bit integer image, there are 255 tone steps per channel. In a 16-bit integer image, there are 65535 tone steps per channel. In a 32-bit floating point image, it depends on the processor and the precise implementation of floating point math, but the answer is "lots". Most of the tone steps in a linear gamma image are concentrated towards the highlights. There are correspondingly fewer tone steps available for the shadows and midtones. When digital imaging first got started back in the late 1990s, computers weren't powerful enough to handle more than 8 bits per channel. So to make the most of those 255 available tone steps, everyone used working color spaces with more or less perceptually uniform tone response curves. Otherwise shadow areas would have been posterized . Posterization is the visually noticeable banding in an image that is caused by too few tone steps spread too far across an area in an image. Posterization from working with 8 bit images is the reason there are so many "film and print" working spaces (AdobeRGB, BetaRGB, BruceRGB, etc). If a color space is too large, shadows aren't the only areas in an image that can be affected by posterization (in Figure 1 above, compare the distance between the reddest WideGamut red and the greenest WideGamut green to the much smaller distance between the reddest sRGB and the greenest sRGB green). So people kept trying to make a color space that was big enough to hold film and print colors without stretching a measly 255 tone steps across too large a color space. Figure 5 shows posterization in an 8-bit linear gamma gradient: Posterization in a linear gamma 8-bit gradient. The gradient is posterized because there aren't enough tone steps in the shadows of a linear gamma 8-bit image to produce the illusion of smooth tonal transitions. Color images are slightly less prone to the appearance of posterization because each channel has its own 255 tone steps, which hopefully are "out of sync" with the tone steps in the other two shadows. However, the shadow areas of each channel are still posterized and depending on the image, the posterization can be obvious, as shown in Figure 6 below: Left: Posterization in the shadow areas of an 8-bit color image. This originally 16-bit image was converted to a linear gamma color space and then converted to 8-bit integer precision, so the shadows are posterized. Right: The same image, except this time the high bit depth original was converted to a color space with an approximately perceptually uniform TRC before it was converted to 8-bit integer precision. In a nutshell, when digital imaging first got started, computers were too slow to allow for anything other than 8-bit image editing. At 8-bits, there's not enough tone steps in the shadows of a linear gamma image (even in small color spaces such as sRGB)to allow for visually smooth tonal transitions. So to avoid posterization, RGB working color spaces had more or less perceptually uniform tone response curves. There seems to be a persistent rumor going around that 16-bit images suffer from posterization in linear gamma color spaces, but I have not found that to be true, even when editing in the super-sized Identity color space. Also, the VFX industry uses linear gamma 16-bit floating point data ("half" floating point precision), and 16-bit integer is more precise than 16-bit floating point. So contrary to rumor, you really can edit linear gamma 16-bit integer images without fearing posterization.