Diagnosing and fixing colour casts in LAB colour mode

August 05, 2013  •  Leave a Comment

A while ago I published a 3-part tutorial on diagnosing and correcting colour casts in digital images using the LAB colour mode, on www.birdphotographers.net. I thought it would be worthwhile reposting the parts here. By way of background, Lance Peters had posted an image of a stone-curlew, which had a blueish colour cast. I mentioned how I would correct this and was invited to detail the method. So, here goes:

Part 1:
First, there are various colour spaces or modes within which you can work in Photoshop. The common one is RGB which has a Red, Green, and Blue channel and various combinations of each make up the gamut of colours available in the colour space. Digital cameras have sensors made up of RGB sensor sites and computer monitors have RGB pixels so RGB is a convenient place to work. In RGB, the detail in an image and the colour information are encoded in each of the colour channels- each one looks like a different black and white version of the image. Check this out by opening an image and going to the Layers palette and clicking the Channels tab, then click in turn the red, green and blue channels.

The LAB (pronounced El Eh Be) colour space has three channels also- L for Luminance, A for a colour range from Magenta to Green, and B for a colour range from Yellow to Blue. This is the toughest part of LAB- getting your head around these two colour ranges. What does blue and yellow have to do with each other anyway? Amazingly, even though there are only two colour channels in LAB, the LAB colour gamut is a lot wider than in RGB. The big difference between LAB and RGB is that in LAB the detail of an image is contained in one channel only- L, and the colour information is contained in A and B. So detail is separated from colour and can therefore be adjusted separately. The attached image shows Lance's beautiful photograph as it looks in the three LAB channels. Note that the A and B channels don't seem to have much contrast or detail but the L channel is full of detail. Separating detail from colour is why LAB is so powerful for correcting colour casts, sharpening (the L channel), removing noise (in the A and B channels), enhancing and separating colours in an image, making selections, and so on.

To work in LAB mode, open an image and select Image->Mode->Lab color. Then take a look at the channels and have some fun with it. Try adjusting the Curves of each channel (more on this later).

I'm going to leave it there for now and recommend that you do some reading about LAB on the web. Wiki has a good article but it's too technical for me. I also highly recommend Dan Margulis' book "Photoshop LAB Color: The Canyon Conundrum and Other Adventures in the Most Powerful Colorspace", published by Peachpit. Some say it's the most ground-breaking book ever written about Photoshop, and there's been lots!

Part 2:

So I want to quickly get into diagnosing a colour cast using the LAB colour space.

Every colour in the LAB space can be defined by three numbers, one for L, one for A and one for B. This is the same as RGB where for example a tone of red might be R=238, G= 13, B=13. In LAB, the L-value gives the brightness or Luminance of the pixel from 0 (black) to 100 (white). The A-value gives a colour from Magenta to Green, and the B-value gives a colour from Yellow to Blue. Neutral tones (i.e., those with no colour) are coded A=0, B=0. That goes for black, white and all the neutral gray tones in between. Numbers on the plus side of A code for increasing Magenta (a warm colour), and on the minus side code for increasing Green (a cool colour). Numbers on the plus side of B code for increasing Yellow (a warm colour), and on the minus side code for increasing Blue (a cool colour). So that same red I mentioned above in LAB works out to be L=59, A=86, B=73. This means it's made up of lots of Magenta and lots of Yellow. A Blue I looked at in LAB worked out to be 56,-19,-52 for L, A, and B, so in this case some Green and lots of blue.


So again neutral tones in LAB get values of A=0, B=0. This is the basis of diagnosing a colour cast in LAB. To look at LAB values in parts of an image, open up the Info panel and pull down the small menu, top right and choose Panel options, and select LAB color for the Second color readout. Then mouse around an image and see how the LAB values change. In the attachment I show Lance's original image. I've placed the cursor over a portion of the image that I judge should be neutral- in this case some white feathers in the shade. The Info panel shows that the pixels under the cursor have values of A=4 and B=-20, which means a little on the Magenta side of neutral in A and heavily Blue in B. Again, if those feathers were truly neutral they should be reading close to A=0, B=0.

So that's how you diagnose a colour cast in the LAB colour space. The process is somewhat subjective because you have to decide what parts of the image "should" be neutral and then proceed from there. In warm, evening or morning light the whites and greys are going to look warm and the A and B values in LAB will both be positive. You would not necessarily want to correct for this because you would remove the very effect you are trying to achieve by going out early or staying up late.

Part 3:

We have reached the stage where we can actually correct a colour cast in the LAB colour space.

Step 1: Convert your image temporarily to the LAB colour space or mode. Choose Image->Mode->Lab color. Photoshop does a pretty good job of converting and you will not see any difference in the image at this stage.

Step 2: Open up the Info panel so you can see the LAB colour readout as you move the eyedropper over the image.

Step 3: Now here's the fun part- chose Image->Adjustments-> Curves or cmd/crl-m to bring up the Curves window. Drag the window around the screen so that you can see it, the image and the Info panel all at once.

Step 4. You will notice that the Curves window has a pull-down menu called Channel and because you have converted your image to LAB, you have Lightness (L, Luminance), a and b channels (Adobe insists on calling the channels this instead of just L, A, and B). Our diagnosis of Lance's image suggested that neutral tones were running about -20 in b and about +4 in a, so we know b is farther away from 0 than a is. Let's correct b first.

Step 5. Choose the b channel from the pull-down menu in Curves. Click and hold the mouse while moving over the image and you will see a small circle moving over the histogram which shows you where the pixels under the eyedropper are found. Mouse over the neutral-tone we previously diagnosed on the neck of the bird and check out where that is on the histogram. To correct the colour cast caused by the B channel, click and hold the diagonal line running through the histogram at the point where the neutral tone pixels reside and pull the line up or down. The direction depends on the direction of the colour shift in B (+ or -) and if you have set the histogram to show white on the right or the left. Don't worry, just pull the line up or down, let it go and check out the Info panel as you mouse over the neutral tone of interest. Have a look at the attached. Here, I've pulled the line down and it has changed the neutral tone from -20 to -1, so down was the right direction. If I had pulled the line up I would have made the problem worse (say -20 to -30). The Info panel is neat because it shows you the before and after values for the part of the image under the eyedropper. Pull down a little bit more to get B as close to 0 as possible for the neutral tone. Repeat for the A channel and there you have it, your image is corrected so that neutral tones really are neutral, that is no colour, A=0, B=0. It's quite alright to have neutral tones running -2, -1, 1, 2 etc so don't get too hung up on 0,0.




No comments posted.

January February March April May June July (3) August (4) September (1) October November December
January February March April May June July August September October November December
January February March April May June July August September October November December
January February March April May June July August September October November December
January February March April May June July August September October November December