Blog articles

Welome to my blog. This is where you'll find my thoughts on images, projects, equipment and all other things photographic.


Adventures in LAB space: selective colour correction in a hurry



When I need to correct colours in an image using Photoshop, I generally work in the LAB colour space. A lot of people seem to avoid LAB and stick to either AdobeRGB or sRGB, but LAB has a number of advantages and can help you do some things a lot faster than the more usual colour spaces. Here, I look a little bit at what Lab is (the theory…) and show how it can be used to target and change specific colours in an image. I’m probably shooting myself in the foot when I say this but… you can skip to the practical example without reading the theory bit – you don’t need to understand the theory to use Lab, I just think it’s nice to know why things happen the way they do.

One important thing: you’ll need to view the images below on a properly calibrated monitor to see the adjustments correctly.

The theory bit: What is Lab?

Well, let’s start with what a colour space is. A colour space is model that your camera, Photoshop, and various other applications and devices use to work out what colour, and how bright or dark, things are. You’re probably familiar with the RGB method of representing colour – here, every point (think pixel, in practical, if slightly inaccurate, terms) has a separate Red, Green and Blue value. These three values together define a unique colour and that’s how your camera records each pixel’s colour – it saves a Red, Green and Blue value. The values usually go from 0 to 255 for each colour. If Red, Green and Blue are all 0, then that represents black. If they’re all 255, that’s white. If Red is 255 and the other colours are 0, then that’s a really bright, vibrant Red… and so on for various combinations of the colours.

An RGB colour space is just a three dimensional graph with three axis (Red, Green, Blue… surprise, surprise) that maps RGB input values to colours. In order that everything (camera, monitor etc.) are speaking the same language and know what colour a particular RGB value should correspond to, they use a standard, documented colour space. (Actually, there is a bit more to it than that – to ensure that the blue of a blueberry as seen by the camera matches the blue of the blueberry when the photograph taken is displayed on a monitor we also need something that takes into account each device’s characteristics and their effect on the way it records/displays colour – this is called a device dependent colour profile, in case you’re interested… but we’ll ignore this complication for now to make things simpler).The two most common RGB standards are the sRGB and AdobeRGB color spaces.  AdobeRGB is structured to represent a wider range of colours than sRGB – we say that AdobeRGB has a wider gamut, to use the appropriate technical term -  although it isn’t possible to display all of the colours in AdobeRGB on a standard monitor or print, so you probably won’t see a noticeable difference unless you have a high-end graphics monitor designed for AdobeRGB.

So, having defined what a colour space is, it’s time to look at what’s special about Lab. Like RGB, Lab colour space has three different values but they represent rather different things. The first value, L, represents lightness – how bright or dark a point is. (In RGB each of the colour values represents a colour at a particular brightness R=100, G=0,B=0 is a brighter and more vivid red than R=10, G=0, B=0. In RGB, there’s no separate lightness channel).

The other two Lab values -  ‘a’ and ‘b’ - represent colour. Both must have values between -128 and +127. In a, -128 represent pure Green, 127 represents pure Red. The values in between are how green or red a particular colour is, with 0 being neutral. The ‘b’ value works in the same way, but has Blue at -128 and Yellow at 127. (Remember that complication of device profiles we mentioned when talking about RGB? Well, lab doesn’t suffer from this – it’s device independent. In fact, it’s so independent that it gets used a lot under the hood of programs such as Photoshop, especially when you are converting an image from one colour space to another).

Lab has some nice properties from an image editing point-of-view that RGB colour spaces just don’t have. Remember how RGB wraps brightness information into the Red, Green and Blue values? Well, that means that when you change how bright or dull something is with an image editing program working in RGB you also change its colour as well (have you ever noticed that colour fades and shifts a little as you turn up the brightness…?). That’s not a nice side effect. In Lab, you can change how bright things are by changing the L value without causing any change to their colour.

Lab is a very wide gamut colour space - it can represent a very large range of colours, more than sRGB and AdobeRGB. This allows us to have many more shades of, say, purple than in the other spaces. That’s very handy when we are trying to make up for the limitations of our cameras – we can stretch out a colour in Lab to give the impression of subtle variations in shades.

Lab’s wide gamut also makes it easier to select a specific colour or colour range using, say, curves in Photoshop than if we were working in RGB (which is the aspect we’ll look at in the practical section below).

Lab was designed to represent colour in as close a way to the human visual system as possible. Shifting colour shades in the a and b channels gives very natural looking changes rather than the sometimes weird effects you get from moving the  Red, Green and Blue sliders in RGB space.

If a=0 and b=0 in Lab, then you have a neutral grey – the brightness of the grey is controlled by the Lab value. This makes it much easier to target neutrals in an image and monitor them for changes (very handy if you’re a people photographer and want to keep skin tone carefully controlled while you’re editing colour).

The practical bit: fixing unrealistic colours  (or ‘Do you have something for my bird – he’s a bit off-colour’)

Let’s start with the problem. This image of a Red Kite on a fence post is suffering from a washed out and generally insipid sky. The sky looked nice and blue on the day that I took the shot, but in bright sunlight my camera couldn’t reproduce the strong blues  and also cope with getting the shadow details  as accurately as I’d have liked. I had to settle for either a darker, bluer sky with not much shadow detail elsewhere, or shadow detail and a washed out sky (note that I said washed out rather than burnt out - Lab won't magically fix loss of detail in overexposed areas). The grass also looks a slightly unrealistic colour, sort of yelowish green – as humans we’re especially sensitive to slight nuances of green, so this is more noticeable than I’d like. The bird itself is fine. So, how can we quickly fix the sky (a problem with blues) and the grass (a problem with greens and yellows) without changing the appearance of the bird?



You could carefully select the sky in Photoshop, using magic wand, lasso or another tool and push up the blue saturation in the sky. Then you could  select the grass and work on that, maybe using  Color Balance / Hue Saturation / fiddling about with the RGB channels. This would no doubt make the photo look better, but all that selecting and adjusting does take time, patience and a degree of skill if it’s to look natural.

So, here’s an alternative using Lab and one curves adjustment layer…


Once you’ve got your image into Photoshop, the first step is to convert it into Lab colour. You can do this either from Image -> Mode -> Lab  or Edit->Convert to profile then select Lab Color as the target space.

Next,  create a curves adjustment layer (Layers->New Adjustment Layer->Curves). When you open the curves  you’ll see the L channel of Lab displayed, something like this:




First things first... if you look at the icons running down the left hand side of the dialogue box above, you’ll notice an exclamation mark on the bottom one. This is telling you that Photoshop has only created an approximate (rather than accurate) graph to save time. I’d advise you to remedy this by clicking on the icon – that tells Photoshop to go back and try harder. More importantly, you’ll now get an accurate graph to work with. As you can see from the drop down box second from the top, we’re currently looking at Lightness – that’s how bright or dark things are and won’t help us fix colour problems. To fix colour we need to change to the a or b channels, so select one of these from the drop down menu.

Here’s the b channel graph (ignore the red labels that I’ve added for a moment...)


The lefthand icon that looks like a pointing hand with two arrows is key to finding out what we need to change. Click this and then slowly move the mouse around the photo itself – you’ll see a dot moving on the graph to show you the b value for whatever point on the picture your mouse is over. You’ll soon notice that the grass colour values are all in the region I’ve labelled G and the sky colour values are all in the region I’ve labelled S. So these are the parts of the curve we need to adjust if we want to change grass and sky respectively.

Start by clicking along the diagonal line to add some anchor points either side of the S and G regions – the purpose of these is to keep the rest of the curve in place when we start adjusting G and S. Now click in the middle of S and drag down or up and observe the change – dragging down immediately intensifies the blues in the sky – just what we wanted! You might need to add a few more anchor points to keep the rest of the line in place, as I’ve done here. Try the same in with a point in the G area – this time, dragging the point down makes the grass less yellow. Note that the other colours in the picture don’t change – just the sky and grass. You can see my adjusted curve below. That was certainly a lot quicker than making lots of selections and adjustments.

(Those of you who have stayed awake up to this point might notice that I've also squished  the bottom left and top right of the original diagonal line in towards the centre just a bit - this intensifies the colours a little more) You can now do the same kind of adjustment to the  with the a channel. As it happens, in this particular picture the b curve is really all you need – you’ll get a feel for this once you’ve worked on a few images. In our Red Kite photo, all the colour we need to change lies in b which, if you remember, represents blue and yellow. If I wanted to make the grass a more vibrant green, rather than just less yellow, then I’d adjust also  the a channel (the a channel holds all the data about reds and greens).

Here are the before and after images side-by-side for comparison . 

The approach described here won’t work on every image, but it does work on the majority. Hopefully, it illustrates one advantage of working in Lab colour space.

Fixing mixed shadow and light images using Lightroom or Adobe Camera Raw

Photographing a scene partly in shade and partly in sun is problematic for two reasons: the two sections of the picture have different amounts of light requiring different exposures; and they also have different colour temperatures that prevent the camera reproducing the scene in the way that we originally perceived it. In this article, I'll show you how I usually deal with these problems non-destructively using Lightroom's Develop module. Adobe Camera Raw (which ships with Photoshop CS and Photoshop Elements) shares the same underlying engine as Lightroom (the controls are just in different places), so you can use ACR to do this if you prefer.

Optimising the exposure differences between shadow and sunny areas

In mixed sun-shade images, exposure is often a problem. If you photograph to expose the shady area correctly (the fox in our example image) the sunny background will be overexposed. If you set your camera to expose for the sunny area, the fox will be too dark. When I photograph people in this situation, I solve the problem by setting the camera exposure for the bright areas and using a flash gun to fill in the 'missing' light in the dark areas. Unfortunately, wildlife doesn't usually hang around while you set-up a flash so another approach is needed. If you shoot your images in RAW format, then it's not too difficult to fix the problem using Lightroom or Adobe Camera Raw.

The original photo of the fox  is shown in the lower portion of the image above. I set the camera exposure for the sunny area as I didn't want to have any white over-exposed highlights in the nicely lit foliage in the background. It was late afternoon, so the difference in exposure between the light and shade areas wasn't too bad - around a stop.  I knew that I wouldn't have to brighten the dark areas too much in post processing. This is important as brightening areas of an image tends to make noise more noticeable and has a detrimental effect on contrast. If the difference is too great then the shade areas will be so dark that there won't be any detail to recover. If I'd had to shoot the same image in bright midday sun, the exposure difference between the background and the fox would have been several stops and this technique wouldn't have worked. You can see Lightroom's histogram for the original image below - as you can see, the right hand side of the graph is close to, but not touching, the axis - this shows that the exposure is as bright as possible without clipping highlights. If you enable the histogram display on your camera, you can check that you've got it right straight after taking the shot.

(Image: Histogram of photo as taken)

(Image: Histogram of photo as taken)


You can see from the camera settings along the bottom of the histogram that I had the shutter speed pretty low for a hand-held 700mm shot (I was balancing on a ladder at the time so 1/320th sec was the slowest I could manage without camera shake). I also had the aperture at its widest value. This was to ensure that I could keep the ISO as low as possible (remember, brightening dark areas makes noise more noticeable so the lower the ISO the better). 

The intermediate image below shows how I adjusted the exposure of the photo in Lightroom. The first job is to set the overall brightness of the image. Although the original exposure prevents any highlight clipping, some of the foliage in the sunny area is a little dark. Using the exposure slider in Lightroom brightens up the middle tones of an image while leaving the darkest and lightest areas almost untouched. So, I moved the Exposure slider to brighten the leaves to a level that I wanted - in this case a value of 0.6 stops. Next I used the Shadows slider to boost the dark areas of the picture. I stopped before getting the fox light enough in order to keep some darker areas in the background. Boosting shadows in this way can often remove true black from your image. This can be put back using the Blacks slider, as shown below. You may have to play about between the two sliders to get the best results. Finally, I set the white point by moving the Whites slider until I just got clipping. In this case, the original photo was pretty much dead on so I made only a tiny adjustment. 

The image is a lot better now, but the fox is still a bit dark and a second problem - colour temperature mismatch - is apparent.

(Image: exposure adjustments in Lightroom)

(Image: exposure adjustments in Lightroom)


Fixing colour temperature and fine-tuning the shadow exposure

In the intermediate image, the background is lit by late afternoon sun which has a warm orange-yellow feel. The shadow areas have a much cooler colour temperature which makes the fox and foreground look wrong. The human brain is very good at fixing colour temperature on the fly - if you were looking at the original scene, you wouldn't perceive this mismatch of lights as your brain will edit it automatically (this is also why you see objects as normal under artificial light at night, while a photograph of the same scene will often look very yellow as cameras don't have the white balance capabilities of the brain). So, our task is to get the colour temperatures of the shadow and light areas aligned so that the photograph looks closer to the original scene as we saw it.

First, we need to roughly select the parts of the picture that need adjusting. Lightroom's Radial Filter tool (the circle symbol below the histogram) can be used for this. If you click on it you'll find that you can draw a circle or oval, and that a set of sliders now appear in the side bar. You can drag the circle, stretch and  rotate it with the mouse so that it roughly covers the area you want to adjust (the fox and foreground foliage in this case). I usually zoom the image out to 1:16 and make a nice big oval (don't worry about the bits that don't fit onto the image - light room will ignore them). Once you've got the oval roughly where you want it, make sure that the Invert Mask box below the sliders is ticked (this tells Lightroom that you're going to make changes inside the oval, for some reason the default is everything but the circle...). You should also drag the Feather slider up - I generally set it to 50 to start - this ensures that the settings you mark are faded in rather than appearing as abrupt changes at the oval boundary.

You can now make your adjustments. To brighten the shadow area a little more, use the Exposure slider. I also put back in a little mid-tone contrast using the Clarity slider. Once the exposure is fine tuned you can fix the colour temperature using the Temp slider to get as close to the original scene as possible. You may also need to adjust the tint a little if the colours aren't quite right. 

The adjustment oval I made missed out the foxes ear. To fix this I simply added another oval (by clicking  New), adjusted it to roughly fit over the ear, and then set the sliders to the same values as the main oval.

Using Lightroom or ACR to do this has the advantage of not actually altering your original RAW file - the changes are recoded separately and only applied when you create a non-raw image for printing or viewing outside Lightroom.

Here's the final image again.