# What Makes a Color Space Well Behaved?

Standard RGB working spaces are suitable for image editing because they are well behaved. The color spaces defined by camera input, printer, and monitor profiles are almost never well-behaved. So what makes a color space well behaved?

Written September 2013. Updated March 2013.

This article is the first of three articles on well behaved working spaces. The second article, Are Your Working Space Profiles Well Behaved? surveys 30 widely distributed proprietary and open source working space profiles and finds that 21 of these profiles are almost but not completely well behaved. The third article, In Quest of Well Behaved Working Spaces, explores the possibilities for creating completely well behaved versions of commonly available working spaces.

## What is a well behaved RGB color space?

### Color balanced

We use RGB working spaces all the time without ever thinking about what a working space really is. One commonly agreed-upon criterion for a "well behaved", "synthetic", "working", or "editing" RGB color space profile is that if R=G=B, the resulting color is neutral gray. Wikipedia merely briefly notes that

Working spaces, such as sRGB, Adobe RGB or ProPhoto are color spaces that facilitate good results while editing. For instance, pixels with equal values of R,G,B should appear neutral. Color Management
In 2006 Andrew Rodney wrote a paper called "The role of working spaces in Adobe applications", in which he went to great pains to differentiate between device profiles (which typically are not well behaved) and working space profiles:
These RGB working spaces are mathematically constructed to provide a color space that provides useful and flexible editing qualities. For example, one benefit of synthetically constructed RGB working spaces is that it is easy to define a neutral color. When each value of red, green and blue is equal anywhere within the entire color space, that color is neutral. . . . In a synthetic RGB working space, you are assured that a color is neutral gray when all three values are equal. For example, R5/G5/B5 as well as R200/G200/B200, or any identical set of RGB numbers defines a neutral color. This behavior is one reason RGB working spaces are often referred to as “well behaved” . . . [emphasis added]

### Normalized

Two other characteristics of RGB working spaces that we tend to take for granted are that if R=G=B=0, the resulting color is solid black, and if R=G=B=the maximum possible value for the bit depth of the image, the resulting color is solid white. A profile that meets these criteria is called "normalized".

"Neutral", "black", and "white" have precise meanings in the CIELAB reference color space. So restating the criteria for a well behaved RGB working space:

1. Well behaved RGB working spaces are color balanced: If R=G=B, the resulting color is neutral, meaning it has LAB coordinates of (L*,0,0).
2. Well behaved RGB working spaces are normalized:
• If R=G=B=0, the resulting color is solid black, corresponding to the LAB coordinates (0,0,0).
• If R=G=B=the maximum possible value for the bit depth of the image, the resulting color is solid white, corresponding to the LAB coordinates (100,0,0).

## Graphs of well behaved and not well behaved ICC profiles

How can you tell whether a color space profile is well-behaved? A quick way to tell is to check the profile's "xicclu" graph. According to the Argyllcms documentation, xicclu can look up "individual color values forward or inverted though an ICC profile table . . . [and] plot the device value composition down the neutral axis." In everyday language, if a profile is well behaved, its xicclu graph's red, green, and blue lines will align; otherwise they'll be offset from each other.

The xicclu graphs in Figures 1 and 2 below were all created using the command line:

`xicclu -g -fif -ir name_of_profile.profile_extension`

Figure 1 below shows xicclu graphs for three well-behaved RGB working spaces:

Figure 2 below shows xicclu graphs for three device profiles, none of which are well-behaved.

## Example working space profiles for which gray and white aren't neutral

For many working and device profiles, the deviations from being perfectly well behaved are too small to be revealed by a xicclu graph. But xicclu can also be used at the command line to provide very precise (to six decimal places) RGB to CIELAB values. Sample xicclu terminal output is shown in the code box below:

`xicclu -ir -pl -s255 -v0 name_of_profile.profile_extension`

The code box below shows sample xicclu output for three WideGamut profiles. The first profile, "widegamut.icc", is not well behaved. The second and third profiles, "WideGamutRGB.icc" and "Widegamut-Lindbloom-values.icc", are both well behaved.

```\$ xicclu -ir -pl -s255 -v0 widegamut.icc
255 255 255
100.001180 0.016013 -0.015228
128 128 128
53.976356 0.009660 -0.009186
0 0 0
0.000000 0.000000 0.000000

\$ xicclu -ir -pl -s255 -v0 WideGamutRGB.icc
255 255 255
100.000000 0.000000 0.000000
128 128 128
53.988570 0.000000 0.000000
0 0 0
0.000000 0.000000 0.000000

\$ xicclu -ir -pl -s255 -v0 Widegamut-Pascale-primaries.icc
255 255 255
100.000000 0.000000 0.000000
128 128 128
53.988570 0.000000 0.000000
0 0 0
0.000000 0.000000 0.000000
```

Where did these three different WideGamut profiles come from?

1. The first profile, "widegamut.icc", has been distributed by several open source and at least one proprietary image editing program. It might have come from a collection of profiles from the old (and no longer available) scarse website. Unfortunately, this profile is only approximately well behaved.
2. The second profile, "WideGamutRGB.icc", came with the 2007 version of the Canon DPP software that came with my Canon camera. Based on its metadata, this profile seems to be the original Adobe WideGamutRGB profile. This profile is well behaved.
3. I made the third profile, "Widegamut-Pascale-primaries.icc", using LittleCMS version 2.5, Pascale's WideGamut primaries, and the D50 white point values from specifications for Romm/ProPhoto. The resulting WideGamut profile is well behaved and is functionally identical to the Canon "WideGamutRGB.icc".

From a practical point of view, there wouldn't be much more to say about well behaved working space profiles, except for one small problem. Many of the working space profiles supplied to you by various providers of proprietary and open source profiles aren't actually 100% well behaved (I've already shown you one example above). Of 30 proprietary and open source profiles that I checked in September, 2013 (the date matters because at least open source software changes rapidly), only 9 profiles (5 AdobeRGB1998-compatible profiles, 3 sRGB profiles, and 1 WideGamut profile) were completely well behaved. The other 21 profiles — including AppleRGB, CIE-RGB, ColorMatchRGB, ProPhotoRGB, WideGamutRGB, and assorted sRGB profiles — were only approximately well behaved. See Are Your Working Space Profiles Well Behaved? for details.