This page Copyright (c) C F Systems, 2004,2005

Color Integrity in Digital Photography

This document was originally written in 2004 and has been kept available to show the roots of our research. Most of what is stated here remains true today (ten years later) but it is incomplete. A newer document Complete Color Integrity is a more complete description of our research findings and is written in both mathematical and non-mathematical chapters to be easier to understand.

CFS-243 - Maintaining Color Integrity in Digital Photography will download the companion mathematical report (297KB PDF) (Use Back Button to Return to this page). For an overview of the what and why of color integrity, click here.

See our page on Dunthorn Calibration for a method of testing your photographic image input system for color integrity and what to do to correct any problems which you find.

We have the ColorPerfect Photoshop plug-in based on the concepts described in this web page and in Complete Color Integrity. This plug-ing is intended to make the adjustments described in here easier to carry out. See our Photoshop Plug-Ins Page for full details.

Initially we intended this tip to be a no- or low-math summary of the rather mathematical treatment we were preparing on the important problem of color integrity in digital photography. As we prepared it, the summary began to take on a life of its own. For those willing to accept a few things on faith that the technical report demonstrates with physics and mathematics, here a simple example demonstrates that there is a basic, largely unrecognized problem in digital imaging and what it means to photographers. We hope that exploring the techniques below with a few of your own photographs will show you that the problem is both real and widespread. As we learned how to maintain color integrity in our basic work methods, our own photographs have gained a natural realism and depth that often was missing in the past.

By color integrity we mean that when brought into color balance, a photographic image reproduces the colors in an original scene as best it can within the constraints of the primary colors being used. While artistic and other considerations certainly allow and sometimes even require that the colors be altered from those in an original scene, such alterations should done by choice rather than by accident, especially unknowingly. We believe that currently the loss of color integrity most often happens unknowingly, the result of working methods that systematically mangle color integrity.

In the mathematical companion report Maintaining Color Integrity in Digital Photography we develop the technical facts described in this paragraph. If you find this paragraph hard to understand, skip to the last sentence and continue on. In the report we show that to properly adjust the color balance of a photographic image (or part of an image) it is necessary for the adjustment to change all of the intensities of a single primary color (red, green, or blue) by the same percentage for all pixels in order to maintain the color integrity of the original image or scene. We also show that in order to darken or lighten an image without changing the color balance, as the red, green, and blue intensity values are increased or decreased, the ratios of red to green to blue light intensities in each pixel must be kept constant. That is, different pixels naturally will have different ratios of red to green to blue, but for each pixel, the ratios of red to green to blue must be the same after the darkening or lightening as they were for that same pixel before the darkening or lightening. Meeting these numerical criteria to maintain color integrity in digital images turns out to be equivalent to a combination of adjusting light levels or exposure times and using color compensation filters in traditional photography.

Current common practices and tools in digital photography often do not recognize these basic requirements. The result is all about us in current publications, prints, and screen displays; in photographs by professionals perhaps even more than in amateur photographs. Once you have learned to recognize the effects, you will be amazed at how often you see them. Programs like Photoshop make it easy to use the wrong methods to balance color and make it difficult to do so correctly. The usual hands-on method described to color balance a digital image in Photoshop is to use the Levels control as follows:



First click the shadows (leftmost) eyedropper button and then click the blackest area in the image to adjust. That sets the black to pure black. Next click the highlight (rightmost) eyedropper button and click the brightest area in your image to adjust. That sets the white to pure white. Then click the middle gray button and click an area that should be gray - it doesn't even have to be middle gray; a lighter gray or darker gray will also work. That sets the chosen spot to pure gray and retains its degree of lightness while hardly affecting either the bright whites or the dark blacks at all. Photoshop Auto Color appears to use a variation on this basic method, although one can never be certain exactly what such a combined Photoshop operation really does.

The problem is that of the three adjustments, only the highlight adjustment makes changes that meet the simple ratio requirements for maintaining color integrity that are stated above. Any middle gray color adjustment always distorts the colors and for the prevailing image standard (with a factored-in video gamma adjustment), the shadows adjustment also distorts the colors, to a lesser degree. Here is an image which has been adjusted in the manner described in the paragraph above:



We expect that most viewers will find this image either acceptable or very nearly so. This is because there is a trap arising from the psychology of vision that makes a person want to accept this color distortion. The physics behind illuminating and imaging a scene cause the mind's eye to expect color balance problems to be most obvious in the lightest areas of an image. If the highlights do not appear to have an overall color cast, the mind assumes the rest of the image also has no color cast and does its best to accommodate to that belief. Large color distortions of the middle tones can pass unnoticed. Such distorted images do have an unnatural look, however, and may give the viewer an uneasy feeling that something is wrong despite the color seeming to be acceptable. Once a person has learned the nature of the distortion and what to look for, it becomes much more obvious. The method used for the above image balances the highlights so they will appear to be correct before it sets the middle gray. Middle gray in Photoshop is really "gamma," an adjustment which tapers off to almost no effect on highlights (or deep shadows). Thus, no matter what the middle gray does, the eye will try to compensate, because the (unchanged) highlights still seem to be in color balance. (Perhaps we need to mention that the more rarely used alternative of doing the middle-gray adjustment first and the highlights second is generally worse, and for reasons similar to the explanation below.)

To illustrate just how distorted the colors are in the above, we used the same starting image that was "color balanced" to get the above image, but this time we adjusted the image using controls which are equivalent to color compensation filters and overall light level adjustments. The following picture has exactly the same change in middle gray that was used to produce the image above, that is, despite what your eyes try to convince you, the colors in mid-range between light and dark exactly match in the two images.



Because the highlights are fairly neutral in the first image, the eye/mind accommodates to accept mid-tone colors that are just as far off as they are in the second image. In the first image, color integrity has been lost, leaving us with an image that we can accommodate to, but it is a far cry from being the correct colors.

For those who are curious just how far off in color balance these images are, we suggest first downloading the image just above, birdh.jpg, which is not color balanced properly but which still has color integrity. Use the Photoshop Levels tool with it and use the highlight slider on the blue channel to remove the yellow cast. This tool acts exactly like a color compensation filter/overall intensity change correction. You will see the image come into fairly good color balance and it will visually remain in reasonable color balance only for a fairly narrow range on the slider. You can also click the highlights eyedropper button and click on light areas of the image to about the same end and if you are very careful of your choices, the color balance may even be better (because adjustments in addition to the blue/yellow are made). However, the brightest highlights in the second bird image were driven to saturation in some channels in order to make the ridiculous color change necessary to match what had happened to the middle grays in the first bird image, so balancing to the brightest areas will not necessarily work well.

To fully appreciate how misleading the accommodation effect really can be, download the first image, birdmg.jpg. Load into Photoshop and use the Levels tool to do a middle gray adjustment on the image. Click the middle gray eyedropper tool and then click various points in the image, trying to select ones which definitely have different color properties but not saturated colors. Wait a minute or two each time, and look away from the display to allow the accommodation process to operate. If the image seems acceptable, save a copy but do not leave it visible on the display. After you have saved several images, bring them onto the display so you can see them all at once. You will be amazed at how widely different the images can be and still appear reasonable, especially when you compare the narrow range that seemed acceptable in the test above with birdh.jpg. You may also be amazed at how bad some of the previously acceptable versions seem in direct comparison with others.

The bird photo is not special. This phenomenon works to varying degrees with all images.

To see what really is happening, consider an image recorded directly as the intensities of light from the three primary colors as they are focused into a camera from a scene. This is very nearly the case if we are using color film and it can be the case with digital cameras as well. We put this image through the "color balance" process described above, using the Photoshop Levels control eyedroppers to adjust the shadow to black and the highlight to white. Despite their names, both the shadow and highlight color controls have definite effects over the whole tonal scale. In fact they are equivalent to combined illumination changes and color compensation filter changes. When both adjustments are correctly completed, the image will be correctly color balanced. If we now use the middle gray eyedropper and touch a true gray point in the image, say a gray card, nothing should happen, because the image is correctly color balanced and the gray is already gray.

Yet we know that this is very often not the case in everyday practice - a middle gray adjustment often has a pronounced effect. The reason is that the procedure puts primary emphasis on the least dependable areas of the image, the deepest shadows and brightest highlights. For film images these areas are into the "tails" of the "S-curve," where the film gradually starts failing to accurately record light intensity and color integrity starts to fail. Digital cameras and scanners are typically even worse about this, going into "saturation," so that the color integrity failure is even more pronounced - bright highlights often go completely white regardless of the color balance. Thus the highlight control, which should be the primary control for color balance, is often rendered ineffectual with results that are usually damaging to color integrity.

Besides these inherent weaknesses, there are many other reasons why selected highlights pixels may not be representative of the entire scene - colored reflections, specular reflections, sun/shade or other differences in lighting quality, etc. When the highlights have been set incorrectly the color balance for the entire image is thrown off. In Routine Color Balancing? we show how to use the shadow and highlight droppers with gray - or known color tones - well into the central tonal range to set color balance. When doing this, the effect on the entire image and all its tones can be seen. It usually will be obvious when an overall color balance is reached even when there are some minor areas that are off balance. If present, localized problems can be treated separately after the overall color balance is done.

Photoshop does not make it easy to make the adjustments required to maintain color integrity. Fortunately, although the color integrity requirements are necessary for the larger, initial image adjustments, they become much less necessary for the smaller fine-tuning that comes later. In fact, the differences become invisible for small changes. At present we suggest that the requirements be strictly observed only for larger changes and to use the full compliment of adjustment tools for fine-tuning.

Also, these requirements assume that the original image has color integrity. Any image that does not respond well may not have had color integrity at the start. A film image may have been mishandled or badly processed, and a digital camera image may have gone through unknown "processing" that involves inappropriate middle-gray (gamma) adjustments. Any technique that produces an acceptable result is fair game with such Images. In fact, we have a tip Color Balancing Difficult Cases that is intended for very stubborn images and that violates all our color integrity requirements, making extensive use of middle-gray color adjustments.

This may sound like all digital images must have the problem we describe above. We don't intend to say that. When the standard procedure makes only a minor middle gray adjustment the problem is invisible, so many of the digital images we see do not have the problem to a noticeable degree - but an amazing number do show it. Below we have outlined steps which will preserve color integrity in digital photographic imaging. It requires a real effort to follow the recommendations, but you will see a difference and your photographs will have a depth that might have gone missing otherwise.

1. Follow the method in Routine Color Balancing? for any important images, at least for large initial adjustments.

2. For color negatives follow the method in Color Correcting Color Negatives, at least for large initial adjustments.

3. Scan in 16 Bits/Channel if at all possible. Convert 8 Bits/Channel originals to 16 Bits/channel and continue to work in 16 Bits/Channel at least until any initial major adjustments are done. For more explanation, visit Preventing Banding and Stair-Step in Photoshop Images.

4. For reasons explained in the mathematical companion report, we currently recommend that if you plan to make a large change to the complete grayscale to change the contrast in an image, convert the image to Lab color first, make the adjustment on the "lightness" channel and then convert back to RGB if you wish. This method is less destructive of color integrity. To clarify what we mean, such contrast changes are usually made using the Levels middle-gray pointer on RGB, although we prefer the Curves tool. If the contrast (or gamma) change is intended not for visual improvement, but to properly drive a printer or some other piece of equipment, do not convert to Lab; do the adjustment in RGB (or CMYK if appropriate). The mathematical report explains this.

This document makes frequent reference to the "intensities" of light of the three primary colors and it may seem that these intensities are directly recorded in the pixels of standard digital images, although we take care not to actually say that. Actually, images are always in terms of intensity ratios, most frequently the ratio of the local intensity to some maximum intensity reference for the image. Moreover, in current practice even the image intensities ratios are not used directly as the digital image. The intensities are "gamma" adjusted, so that in place of each intensity a larger (brighter) number is used, with the increase in brightness tapering off toward both the highlights and shadows. The problems that this causes are covered in the mathematical report, and it would be very difficult to meaningfully discuss them without mathematics. Photoshop often pays no attention to the difference, even when it should, and that makes it difficult to know when this convention will cause color integrity problems and when it makes no difference. There also are times when Photoshop actually does compensate correctly for the difference. In our recommendations we try to keep away from problem areas, and when that is difficult or impossible, to keep the loss of color integrity to a minimum.

For those interested in learning more about gamma, visit Silver-Based Gamma, Video Gamma and Levels.


As these methods are original with us, you are welcome to use them in an article, a course, or a book but please credit C F Systems and www.c-f-systems.com

E-mail us (cfs.cfs@c-f-systems.com).
Privacy Policy and E-Mail
Go to C F Systems Home Page