Getting Around in GIMP - Color Correction

The list of all my GIMP tutorials can be found here.

I've noticed that many people are interested these days in color processing effects for photos, and thought I'd share some interesting things to get people started on the path to color grading.

I almost always do some sort of color toning on my photos. Sometimes a little, sometimes quite a bit depending on my mood and vision at the time. I'm a big fan of just trying things out a bit to see where it gets me, and often this will change the course I may have been heading down into a completely new direction (I encourage this idea of playing around, especially in GIMP).

(This tutorial is a deeper look at a thread I originally started on the Flickr Gimp Users Group)

To begin, we should probably look briefly at balancing the colors in a photo to make sure we have a good base to start off with...




Basic Color Correction

Sometimes an image can come out of your camera looking either a little hazy or dull (possibly lacking contrast). So how can we get some "pop" back into the image? I will usually start by adjusting the overall range of the image to suit me.

What I mean by this, is that I want to identify the part of the image that will be pure black, pure white, and middle grey. So how can we do this? Well, a couple of ways...

Colors → Auto → White Balance

This method will let GIMP automatically calculate for you it's best estimate of what the white balance should be in the image. Sometimes this can produce OK results (and sometimes it can really mess up). I don't personally use this option, but if you want a no-frills first guess automated for you, it's a nice option to have.

I have also noticed that auto white balance can sometimes blow out highlights in an image as well...

Manual Balance

This is the method I have been using personally for a while now. The theory is basically that I want to identify where in the image I want the blackest blacks to be, the whitest whites, and a good middle grey point. So how can I find these quickly and easily in my photo?

Here's a hint: Colors → Threshold

Threshold will give you a means to see where the extreme pixel values for your image occur. With it we can identify where the brightest and darkest pixels are. The basic idea is to use a Threshold to isolate the brightest and darkest pixels in your image to set the white and black points, and to use a neat trick with a 50% gray difference layer to find the middle gray point.

So let's begin...


Image courtesy of Kelly Ealy - MM# 7866

Open an image you think could stand a little color correction.

Right click on the background layer and Duplicate Layer. This is the layer we will be working on fixing the color, and I'll call this the color correct layer.

With the color correct layer active (remember: white border around it), activate the Threshold dialog.

Colors → Threshold


Setting the White Point


We'll start by finding our white point in the image. The white point marker is already (be default) all the way to the right, and the black point marker is in the middle. What we'll do is pull the black point marker all the way to the right as well.


This should make the entire image show black (with possibly some white showing in places). What this means is that the white pixels, if showing, represent the brightest pixels in your image. If you don't see any white pixels yet, you can begin pulling the black point slider to the left slowly, and they will eventually begin to appear. You'll want to note the location of the first white pixels that begin to show up, and either remember them or use a sample point to save their location.

An important thing to remember here is that this is often a subjective determination of what you want to be pure white in your image. Some bright pixels (any RGB component is 255) will show up in threshold, even though they may not be "pure" white. Watch out for those, as a non-neutral color chosen to be your white point will cast a color on the entire image.

Cancel out of the Threshold dialog.

Now we want to use Colors → Levels to set the white point for our image to the pixels we identified with Threshold.

Open the levels dialog (Colors → Levels), and use the Pick White Point eyedropper to pick the location of the whitest pixels we just identified.


Hit OK to apply to the image. We basically just identified the location in our image we want to be pure white (255, 255, 255) in our final image.

Setting the Black Point


Now we can do the same procedure, but for the darkest/blackest point. Open the threshold dialog again (Colors → Threshold), and this time slide the black point slider all the way left, and do the same for the white point marker. The image should turn all black.


Slowly begin sliding the white point marker to the right until some white pixels begin to show up. These white pixels now represent the darkest pixel values in your image. As before, note their location (or use a sample point) and cancel out of the Threshold dialog.

Open the levels dialog again (Colors → Levels), and this time use the Pick Black Point eyedropper to pick the location of the darkest pixels we just identified.

Hit OK to apply to the image. We just identified where we want the blackest pixels in our image to be (0, 0, 0).

Setting the Gray Point


This one is a little tougher. You may not have an easily found truly neutral gray point (RGB 128, 128, 128) in your image. So we are going to use some layer blending modes to help us find the gray points closest.

Create a new layer above your color correct layer, and fill the layer with a neutral gray (RGB - 128, 128, 128).

Set the layer mode for this gray layer to Difference.




Right click on the layer in your Layers window, and choose New From Visible to create a new layer with what you can see. Make sure this new visible layer is the active one.

Now, run a threshold against this new layer.

Colors → Threshold

You will now follow the same procedure as you used for finding the black point threshold values, but in this case the white pixels will be those closest to Middle Gray.

Zoom into those first white pixels and remember where they are (or use a sample point).

De-activate the difference layer, and make your color correct layer active and visible. It helps if it is also the top-most visible layer (ie: turn off visibility on all layers above it in the Layers list).

Now use Colors → Levels again.

This time, use the Gray picker and choose the pixels you identified as closest to middle gray.

If you've chosen good points then the final result should be an image with much better looking color overall. If there was a nasty color cast previously, this method should remove it for the most part...

Here is my starting image, and after modification using this manual method:


It's subtle, but the original image was not in serious need of any balancing.

Mouseover the image below to see a comparison on an image where I didn't white balance properly before firing the shot (only modifications to the image were the manual color correction procedure):


Please feel free to post any comments/suggestions/rants in the comments if you get a chance to try this method out!

24 comments:

  1. This is a great and clear tutorial. Going to try this one out soon. Thanks for this

    ReplyDelete
  2. t-no:

    Thanks! I'm hopeful that it might be useful to others in some way, and perhaps get people thinking more about color manipulations for their photos.

    ReplyDelete
  3. Excelente tutorial! Gracias!!..Thanks!

    ReplyDelete
  4. Wow, Pat. This is really helpful. Thanks for putting this together!

    ReplyDelete
  5. Thank you for posting this tutorial. Comment: I am assuming you meant to slide the black point+white point slider all the way to the left (when finding the black point). Question: How do I use a sample point to pick the pixel? Thank you very much for your time!

    ReplyDelete
  6. P.S. What do you mean by "middle gray"?

    ReplyDelete
  7. Yep, I did mean left, thank you for catching that! :)

    I am not sure you can use a sample point directly to pick a pixel (with an eyedropper/picker). But you will be able to zoom into the exact pixel location, and should be able to choose from there. (It would be nice to be able to just use the existing sample point, though).

    Middle Gray = RGB 128,128,128 (red = 128, blue = 128, green = 128).

    ReplyDelete
  8. Great tutorial, easy to follow and the result of my test was incredible. Because my image was a little desaturated, at the end I just increased the saturation and ended up with great colours as well. Thanks for sharing!

    ReplyDelete
  9. Nice post - thanks! I've never used the difference mode, and I had to think a bit to understand why you'd then look for the blackest point in the threshold of the "new from visible" layer.

    I do want to point out that when getting a black point and a white point, one doesn't always want the darkest or lightest point in the picture - for greater contrast and more effective results, one wants the darkest or lightest points in which one wants to *retain the detail*. (This isn't my revelation, I got it from Dan Margulis's Professional Photoshop book.)

    Also, there may be a color to the lightest or darkest point that is a real color, and you don't necessarily want to turn *that* into white or black. So you have to use judgment in picking the lightest/darkest that you want to hold detail in, that actually IS white/black.

    Cheers.

    ReplyDelete
  10. @rasraster

    Thanks! You are absolutely correct on picking black and white points, though if you filter the image on the highest and lowest luminosity value (which is basically what I describe), you are effectively clipping the black point to the lowest place you even have any detail. Any lower and by definition there is no darker details to find.

    And yes, there may be a color cast using any of these methods because we are mostly working on luminosity values. It is true that a gray point closest to middle gray might have a different red, green, or blue component, in which case a color cast will be introduced if that is set to middle gray. It's really something you have to have an eye for to watch out for, and to decide if it is acceptable or not.

    This method just helps you get as close as you possibly can (assuming a gray card or color card was not used in the scene).

    But thank you for pointing out these important points!

    ReplyDelete
  11. Thanks David,
    I applied this method twice, see the result in yhis post http://www.canoniani.it/forum_forum.asp?forum=4&section=57&post=513966&page=last (it's in italian but look just at the photos to compare them before and after).

    ReplyDelete
  12. Thank You very much! I am using GIMP for two days, and thanks to turials like yours, I think I will like it. A simple and efficient lesson. I've got my first manual "color correction" photo :) THX! Magdalena

    ReplyDelete
  13. Awesome Tutorial. Thank you. Kudos!

    ReplyDelete
    Replies
    1. Thanks! I'm glad you found it useful! :)

      Delete
  14. So what would you suggest as the best way to deal with a color cast after using this process? Currently I'm just manually adjusting the color balance by eye. Thanks.

    ReplyDelete
    Replies
    1. Usually I will just resort to manually adjusting things by eye as needed after this. Remember, this method just gives you the locations of greatest lumninosity in your image. Often I'll sample points in the greatest luminosity and have a look at what the RGB values are, then adjust curves accordingly until it achieves something that I like.

      And sometimes it just won't be possible to correct (mixed lighting situations are particularly nasty sometimes - like a flash that isn't gelled with sunlight or some other light source).

      Delete
  15. Awesome tutorial david. I just have a question about the difference blending mode to find the middle grey. Why this mode instead of another i don't understand this part.

    ReplyDelete
    Replies
    1. Thanks!

      The difference blending mode will show you areas in the bottom layer that are different from the colors of the top layer - in this case places where the colors are not near middle gray (127,127,127).

      Delete
  16. what do you mean when you say fill the layer with a neutral grey (the step before changing the mode to difference)? Clearly it is not using a bucket fill but then how else?

    ReplyDelete
    Replies
    1. You can use the bucket fill to fill the layer with gray.

      Delete
  17. Good to know there is another way towards white balance apart from auto. (I have noticed that can burn out areas in a photo).
    Can this method be used also for 'manually' colour correcting colour negatives. I have just started doing these and need more gimp input.
    https://www.dpreview.com/forums/post/58386125

    ReplyDelete