Matching Colors in Photoshop
Photoshop has built-in tools that make it fairly easy to match colors between two images. The problem, like so many other features of Photoshop, is that the easiest way is really the wrong way. This tip is a spin-off from the Routine Color Balancing? and Color Balancing Color Negatives tips on this web site, and we recommend looking at those more basic tips for anyone wanting more detail and a better understanding of what is happening here.
This paragraph was added in January, 2004. Photoshop 8, also called Photoshop CS, has recently become available and it includes a "Match Color" tool. I naturally assumed that would make this color matching tip redundant. Now that I have been able to test the new Match Color tool, I realize that is not the case. Whatever else may be said about it, the CS Match Color tool does not try to maintain overall color integrity of the image, as this tip does. I was able to make Photoshop CS Match Color produce color matches of the approximate quality shown in the PDF manual, and so was able to examine the results and determine that they do not maintain color integrity. These matches might be adequate for less critical work, however. Experimentation with the tool often produced bizarre results and it may well be useful in cases where overall color integrity is not the goal (see at the end of this tip), but not much more can be said at this point.
The tip below is intended for the situation in which you have two photographic images and you wish to match the color of some area in the two images while maintaining the color integrity of the images. There has been considerable interest in this tip and it is obvious that previously I had not made this objective clear. For example, one correspondent did not think the tip was correct because he felt it did not work well when matching sky blue to flesh tones. Now, there is nothing inherently wrong about doing something as extreme as trying to match sky blue to flesh tones. In fact, selecting the green leaves of trees and matching them to fall colors from another photo comes to mind as a practical example. When you do something like this, however, preserving the color integrity of the individual images can no longer be an objective. More about this at the end of this tip. See Color Integrity in Digital Imaging for a full explanation of that important topic.
The following two images will serve as an example, with the objective of matching some areas of the greens in the two images. Anyone with experience in this area will immediately wonder why we don't match the whites (actually very light grays) in the two flowers. Indeed, that would be easier and more likely to succeed, particularly since there is no guarantee that the greens actually should match. In this tutorial, the whites will serve as guides for the eye as we go through the process. As we match the greens, watching the whites will make it easier to observe and understand what is happening.
Before we start operating on the these images, we need to be sure the picker-dropper tool is set properly. Click the dropper button on the main menu and set the sample size to 5 x 5 average. Depending on the version of Photoshop, this may be available as a pulldown near the top of the Photoshop display or as a choice on a menu obtained by "right" clicking when the dropper is over an active image.
To match a color between two images, they must both be loaded into Photoshop and positioned so that the areas to be matched will both be visible. Here we will try to match the green in the nodding mandarin (left image) to the green in the trillium (right image). For those who wish to follow along, the above jpeg image can be loaded into Photoshop and a rectangular selection made of the picture to be treated prior to starting the Levels tool. In later usage, the two pictures will normally be in separate image windows, and care must be exercised to have the proper image active and the part of the other image with the matching color still visible. With the images loaded and the mandarin selected, call up the Image→Adjustments→Levels tool.
This tip assumes a detailed knowledge of the Levels tool. For those who find the following confusing, read the explanation found in Understanding the Parts of the Levels Tool first.
As we have explained elsewhere, the three picker-dropper buttons at the lower right are really color matching tools, though they are most often described as tools for setting the shadow, middle gray, and highlights, reading left to right. As is the case in color balancing an image file in Photoshop, the rightmost picker-dropper tool is the only one that can be used if the color integrity of the image is to be preserved. Select the rightmost, highlight picker-dropper, and then double-click the button to bring up the color picker dialog.
This will make the mouse cursor appear as a dropper when outside the above dialog box. Position the dropper over the green leaf in the trillium side of the image and select a fairly dark green. The green will be picked up despite the fact that only the mandarin side is in the original rectangular selection. The color will appear in the small rectangular window of the color picker dialog. Click OK in the color picker dialog to close it. Now position the cursor over a green area in mandarin that you wish to match and click - the highest leaf is a good area. The entire image will change. Click again and observe that the image changes. The results depend on the fine texture of the leaf. Note that the major changes are light/dark rather than color. Continue exploring until the result is pleasing.
The above process produces an exact match using the digital equivalent of color correction filters, which is the only way to preserve the color integrity of the image. Almost always the result will be lighter or darker than it should be. The degree of this can be best observed by having Levels display the histogram for a color, green in this case:
The highlight slider under the histogram (or the Output Level slider) will move as matching selections are made. In the dialog box above, the highlight slider is too far to the left, meaning the entire image is too light and that highlight detail is lost. A new (darker) reference color should be chosen and an attempt made to end with the highlight slider near the right end of the dark mass of data in the histogram. This will never be perfect, however, and for best results a final adjustment of the Levels numbers should be made. See Final Adjusting Levels to learn how that is done. When exiting from the Levels Dialog, you may get a message "Save new target colors as defaults?" Unless you have good reason to do otherwise, click the No button. We ended up with the following:
As we have seen, fine detail can make it difficult to match two areas which have the same general color. Using a 5x5 color picker helps in this, but for really difficult cases, use the lasso to select an area of the desired apparently uniform color in the image and apply a blurring filter that appears to retain the color in the selection; a gaussian filter of 10 pixels (much more for a high resolution image) is a good starting point. Do this in both images, and then apply the above matching procedure. When the match is achieved, use the Save button in the Levels dialog to save the result. Revert or undo the two images to prior to the lasso selection and gaussian filter, apply the Levels tool to the proper image and Load the levels setting from the file just saved.
It would be possible to do the above process in reverse, of course, using the mandarin as the reference and changing the trillium. It is very instructive to try this - our best result follows:
Rather disappointing, no? The poor color balance of the mandarin has been transferred to the trillium. While the poor balance of the mandarin might have slipped by, the trillium won't. Paired, they both look bad. So, it is necessary to start with a good reference in order to produce good results.
At the start we said that all three picker-droppers in the Levels dialog are really color matchers. In fact, it is much easier to achieve a color match using the so-called middle gray picker. The procedure starts much the same as above, double-clicking the center picker-dropper button and selecting a reference color. From there on it is easier, as the light/dark is changed very little for any reasonable match selection. There is little need to try different reference spots, nor is it necessary to do any final adjustment to the numbers as is usually the case with the recommended procedure. Why, then, not use this method? The reason is color integrity. We used the middle picker-dropper to do the same adjustment as above, using the mandarin green as a reference and matching the trillium green to it, with the following result:
When we tried this match using the recommended method, with the mandarin as reference, the resulting trillium image was unacceptable. Here the trillium might be considered acceptable. What is wrong with that?
In fact, that is precisely the problem. Using the middle picker-dropper, the "corrections" have been made using individual color gamma adjustments. Color integrity has been lost. Without a direct comparison to the properly corrected images we might well accept the above as satisfactory. Once color gamma adjustments have been made it is very difficult to restore color integrity, and no matter what is done, the colors will be a little strange, even if acceptable to the viewer. Once you begin to recognize this effect, you will be amazed to see how often color integrity has been compromised in the present world of digital imaging. This is not to say that adjustments of individual color gammas should never be done, only that they should be a last resort. As we point out in Color Balancing Difficult Cases, color gamma adjustment is sometimes the only way to produce a usable result, particularly if the original has already had color integrity compromised. But color gamma adjustment should not be a starting point. Other methods should be used first and every effort should be made to have any final color gamma adjustments as small as possible.
All the above is intended for the situation in which you have two photographic images and you wish to match the color of some area in the two images while maintaining the color integrity of the result. If you are trying to force a match of differently colored areas, such as matching green leaves to fall colored leaves, trying to maintain color integrity of the resulting image is a meaningless concept. Here the objective is to produce an image in which the two target colors match and the rest of the image ends up as acceptable. Matching as described above is still a very useful tool, but matching with the middle gray picker or the shadow picker may actually produce results that are more acceptable than those obtained with the highlights picker. It is also very likely in such cases that the careful use of area selections, applying the color adjustments only to portions of the image, may be necessary for success. Dividing up the total change required for such a match into smaller successive adjustments made to a sequence of partially overlapping selections can be an extremely effective tool.
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
Go to C F Systems Home Page