The RGB Code: The Mysteries of Color Revealed

Part 3: Color Differences and Converting Colors

By Danny Pascale
of BabelColor.com

Dateline: November 24, 2004
Read Part 1 and Part 2


In the last installment our heroes had found the secrets of the RGB code, and now they wanted to spread the truth. Others may have chosen to use their new found knowledge to rule the world (graphic world, that is), but they wanted to share it. Their first idea was to publish a book, The Secrets of the RGB Code, to be published by their own newly-formed publishing house. For marketing purposes, they wanted a large printout of the book cover, designed with a carefully-selected shade of pinkish blue for its background, a task they could not perform on their small home printer.
One of the most common tasks when dealing with color is to determine how far you are from the desired color. This could be the color seen on your monitor relative to what it should be, based on the RGB space of the image you look at, or how close a printed color is relative to a color you have as a reference (RGB, L*a*b*, etc.). Another problem you may have is to determine the equivalent color in two different RGB spaces, such as sRGB and Adobe (1998).

Often these tasks can be handled by simple spreadsheet formulas or performed through color management functions within your graphics editing programs. But you may need specific answers for a critical color, a company logo for example, and you may not want to bother with spreadsheets. This is the time when you need to delve deeper in your understanding of color (not the mathematics themselves, which can rapidly become quite complex).

Let's look into these tasks.

Color Differences

While many work exclusively in RGB (remember that we are talking of the gamma corrected version here, i.e. R'G'B'), they will never use RGB units as a basis for color differences. The main reason is that even if the gamma corrected values make it somewhat more perceptively uniform than XYZ, it is still not uniform in terms of the perceived color difference when comparing colors with fixed increments of R, G or B. The L*a*b* space has traditionally been used for this task.

Color differences are expressed as DeltaE, a value based on the Euclidian distance (the shortest line in three dimensions) between the coordinates of the reference and sample (Note: the word "Delta" is often shown as its Greek symbol, a small triangle). For the L*a*b* space this difference is called DeltaE*ab.

While this color difference formula is the one used most often, it was found that the computed color difference did not precisely correspond to the perceived color difference for all possible sets of compared colors. Efforts in making this color difference even more uniform have first brought us the CIE94 and CMC color difference formulas. The most recent color difference formula, DeltaE2000 (CIEDE2000), is just starting to be used by the general public and has generated very positive comments so far. These three color difference formulas, CIE94, CMC and CIEDE20000 are all based on L*a*b* data, to which they add correction and weighing factors.

In all of these, the goal is that a color difference of 1 corresponds to a barely noticeable difference by 50% of the persons comparing the two patches. That is, the difference formula should work equally well for whitish-blue colors, saturated reds and dark brown shades, a very difficult task indeed. CIE94 is often considered a "better" choice for small color differences than DeltaE*ab, which is a "good" all around choice, especially for large color differences. Be aware that CIE94 values for small color differences are about half the numbers obtained with DeltaE*ab, so specifying which color difference formula to use for comparison is important (when looking at the specs of a colorimeter, for example). While a color difference of 1 may often create a debate, a color difference of 5 will be noticed a lot more rapidly by more people. The 1 to 5 range is a good place to start. More critical graphic design applications may go toward the low values, whereas applications in which it is difficult to compare the color with a reference could well go over 5.

To place the conversion errors in perspective, the conditions in which these images will be seen have to be taken into consideration. One of these conditions is the observation time. According to a review article by Has & al. (see Ref. 1), an inexperienced user will take approximately 5 seconds to notice a DeltaE*ab difference of 15 from an original. The time goes up to 10 seconds for a DeltaE*ab of 10 and 15 seconds for a DeltaE*ab of 5. Note that we are talking about complex images, not single patches being compared side by side.

Another study (see Ref. 2) has shown that errors of less than 2.5 DeltaE*ab are not visible on real-world images shown on a CRT monitor. As for printed material, errors between 2 and 4 DeltaE*ab are mentioned by Has & al. as typical of the accuracy we can get from the offset and rotogravure processes.

On the hardware side, it has been shown (see Ref. 3) that CRTs require a warm-up time varying between 15 minutes and three hours, depending on models, before achieving a long term stability of 0.15 DeltaE*ab on average. On a given CRT subjected to a large luminance variation, an initial DeltaE*ab of 1.0 was seen to exponentially decrease to about 0.1 DeltaE*ab in 60 seconds. The practical implication here is that when a monitor is shut down by an automatic power saving feature, it will not be as accurate in the following minutes after it starts again.

If the previous paragraphs appear nebulous let's go back to our heroes, who are now looking at their enlarged book cover as it returned from the printer, and see how they compare a sRGB color with the measured result obtained from an "unreliable" printing center.

They had sRGB (143, 144, 211) as the background color for their book. They felt the pinkish blue (lilac), gave just the right impression to the book content. They went to their local copy shop, which they knew had a large-format inkjet printer. The returned print looked so bad that the copy shop did not even charge for it but claimed that the Photoshop file supplied by our heroes was at fault and suggested the use of a Quark or Illustrator file, instead (based on true story!). The shop had provided nice prints with the same file format in the past, but they may have fallen on a different operator, on a bad day, who knows. Or was it yet another plot to prevent them from publishing their book?

After numerous Internet searches, they finally found someone in their neighbourhood that was willing to come and look into the problem. This person, a modern Master of color management, came with his almost alchemic instruments: a colorimeter and a spectrophotometer. They did not know at the time, but he was a member of the Ancient and Mystical Order of RGB Space (AMORS), which had as its goal dissemination of color knowledge and the love of beautiful colors. One of this order’s symbols is in fact the RGB triangle, first defined by James Clerck Maxwell, the order’s founder, as a basis of his color theory.

The Master did not need a measurement, nor to go to Maxwell’s tomb, to see there was a problem He used his instruments to convert golden light into numbers. Its verdict for the printed background: L*a*b* D50 (57.2, -7.7, -45.6).

Let's have a look at their data and compare it using a color conversion tool. In the following image, the left side corresponds to the required color. The RGB coordinates are shown as well as the corresponding L*a*b* and L*C*h* values. On the right side is shown the measured L*a*b* value, used as input, as well as the corresponding L*C*h* and sRGB values.

Between the two are patches of the corresponding colors and some color difference data, set to show DeltaE*ab values. The DeltaE difference is 22.4. Other numbers labelled as DeltaL*, DeltaC*, DeltaH*, and Deltah* correspond to the difference in lightness (L*, perceived luminance), Chroma (C*, describing color saturation), hue (H*), and hue angle (h*, hue expressed as an angle between 0 and 360 degrees) between the two sides.

As mentioned in Part 2 of this series, and shown again in the first illustration of this article, L*C*h* is derived from L*a*b* but it replaces the a* and b* chroma coordinates by a single Chroma vector and the angle that this vector has relative to the origin. C* and h* are more closely associated with how we perceive color than a* and b*. That being said, DeltaE* based on L*a*b* is identical to DeltaE* based on L*C*h*.

By looking at these Deltas, you should be able to see that the printed color presents a very big color shift (Deltah* = -27.7 degrees), is much more saturated (DeltaC* = +9.59) and is a bit darker (DeltaL* = -4.49). If you take the hue angle of the reference color (h* = 288 degrees) and look at where this angle falls on the L*a*b* diagram shown at the start of this section, you see that this is a well-defined reddish blue, whereas the angle of the measured color (h* = 260 degrees) is a greenish blue. Overall, it's a mess!

If you base your color difference judgment on the RGB values alone, the only thing you can say at first glance is that the measured color lacks red. It is less obvious that there is more saturation although this can be deduced by comparing all three RGB numbers; however, quantifying that saturation is near to impossible using RGB numbers.

Once again, numbers brought them knowledge. Cracking the RGB code was just the first step, not the final answer.

The Master then spent some time calibrating their old Epson 600 printer, loaded with old third-party inks. Once his 20-minute calibration ritual was done, they printed their book cover and measured the background. The L*a*b* D50 data was now (59.7, 14.6, -30.2). Magic!

Analysing their new data shows a DeltaE*ab difference of 5.98. While not worth a gold prize, this "match" could be deemed acceptable in many circumstances, including the book cover for which it was selected (yes, better results can routinely be obtained in a well-calibrated color workflow). In any case, such a difference would be quite difficult to perceive, if part of a complex image with lots of colors.

The point of these examples is to show that using a color difference value as a method of controlling the accuracy and quality of your prints can give you some benefits. You are better able to judge your supplier's performance and find corrective measures if there is a problem, especially if they are willing to cooperate. The second example also shows that very acceptable results can be obtained at home, when proper means are used. (And some money; the cost of the instruments used to calibrate printers can be of the same order, for colorimeters, or way more expensive, for spectrophotometers, than what you pay for decent home printers.)

In the two illustrations of the examples, L*a*b* and L*C*h* are shown in Illuminant D50 even though the sRGB space is defined in Illuminant D65. By the way, this is how Photoshop displays L*a*b* data, always in D50, irrelevant of the working space Illuminant. The L*a*b* values for D65 are different and you should not compare L*a*b* numbers determined from different Illuminants; if you are stuck with such data, you have to convert one set or the other. This is the subject of the next section.

Converting Colors

Pleasantly surprised by the results obtained by the Master, especially with their old equipment which they thought obsolete, our heroes decided to purchase a colorimeter and calibrate their monitor themselves. They now had another tool in their arsenal to help them in their frequent encounters with the RGB codes.

The Master suggested using the ProPhoto RGB space, a very large RGB space that covers a large percentage of the human color gamut, for some of their book illustrations requiring precise colors far outside the range of sRGB (Note: selecting a large RGB space should always be considered carefully, and it is strongly suggested to use 16-bit files to prevent color banding). Their next challenge was to find a way to convert some of their RGB coordinates from sRGB to ProPhoto.

They could have converted their images between these two RGB spaces within a graphics edition program and compare the original and converted colors with the eyedropper tool, going back and forth between the two images. But our heroes wanted more; they wanted some knowledge of how it is done, and be able to compare the numbers side by side.

One of the problems of this conversion is that the sRGB space is defined for Illuminant D65 and ProPhoto is defined for Illuminant D50. This job would be somewhat facilitated if they had the spectral data of the sRGB color. Using the spectral data, you need only to recalculate the XYZ coordinates using the spectral emission curve of D50 and the method presented in ASTM E308 (the reference is given in Part 1); then, from XYZ, go to RGB (linear) and R'G'B' (gamma corrected). As we mentioned before, this approach is not recommended for those unfamiliar with the mathematics of colorimetry. But this solution does not even apply here, since our duo do not have the spectral data, only sRGB values.

The solution is to use an approximate method, called a Chromatic Adaptation Transform, which applies a matrix transform directly to XYZ coordinates to change the Illuminant from D65 to D50. Such a matrix has to be derived for each pair of Illuminants; the matrix between D65 and D50 is not the same as the one between C to D50, etc. There again, some mathematical knowledge is required but tools are designed to handle this task easily. The conversion process goes as follows:

If this conversion process is applied to the original sRGB data of our example, the result is:

The sRGB (143, 144, 211) coordinates represent the same color as the ProPhoto (138, 128, 192) coordinates. The color difference is zero (Note: the displayed ProPhoto coordinates are rounded). From what you have learned before, this should not be a surprise. Accordingly, if different coordinates in two color spaces represent the same color, the same coordinates used in sRGB, ProPhoto, Apple RGB, or any other RGB space do not represent the same color.

In many graphic editing programs, similar transforms happen constantly behind the monitor screen, based on ICC profiles. Such is the case when your input file, in Adobe (1998), is translated to your calibrated sRGB monitor, for display purposes only, or when the same file is converted into yet another color space defined by your printer's inks, most likely not an RGB space. These translations can be done with different "intents" and you may see such terms as "Perceptual", "Saturation", "Relative Colorimetric", "Absolute Colorimetric" with still further options such as "Black Point Compensation". These intents and options all affect the final outcome, a subject which has been covered by many color management specialists (Masters!).

By constantly gathering information, reading and experimenting, our heroes managed to learn the many facets of the RGB code. At their suggestion, the local print shop hired their new Master friend as a consultant; they now obtain accurate and consistent colors from this supplier. What seemed like a plot against them was just a lack of knowledge.

They printed happily ever after.

Conclusion

This concludes this quest about finding the secrets of the RGB code. However, once you start looking into the myriad details and options that colorimetry offers you, you may realize that it is only the beginning.

References

(1): M. Has, T. Newman, Color Management: Current Practice and the Adoption of a New Standard, available on the ICC Web site.

(2): M. Stokes, M.D. Fairchild, R. S. Berns, Colorimetric Quantified Visual Tolerances for Pictorial Images, Comparison of Color Images Presented in Different Media, Proc. Vol. 2, 757-777 (1992), M. Pearson ed., Tech. Assoc. Graphic Arts and Inter-Soc. Color Council.

(3): R. S. Berns, M. E. Gorzynski, R. J. Motta, CRT Colorimetry, Part II: Metrology, COLOR research and application 18 (5), 315-325 (1993).

Get the free Graphics.com newsletter in your mailbox each week. Click here to subscribe.

Danny Pascale: After many years of research and development, and project management work in the academic and industrial sectors, he now does technology assessment and helps companies bring new products to the market (a consultant, if you prefer!) in the computer and consumer electronics industries. He recently formed a new company, BabelColor, dedicated to the development of colorimetric software tools.