Getting Around in GIMP - Adjusting Levels

The rest of my tutorials are here: Getting Around in GIMP

In my previous post on Color Correction, I outlined a method for finding the lightest and darkest values in an image using Colors → Threshold. What I may not have mentioned in that post was that the process described will actually level balance your images for you automatically if you follow the steps (choosing the darkest and lightest pixel values to represent black and white in your image).

If you were just interested in basic level adjustments, I thought I would cover that here.


Original image by Danielle Scott on Flickr.

Results of a basic level adjustment.

Original image by Alexis O'Toole on Flickr.

After a basic level adjustment.

What Level Adjustments will do is allow you to change where the brightest and darkest pixels in your image are. I say brightest/darkest because Levels will allow you to change the relative value of pixels across your image. (Color correction should be approached using other methods).

This means that you can control the brightest and darkest pixel values across your entire image using only the Levels slider, and you can adjust the gamma. If you don't adjust the middle level control, the response is linear across your image values. Let's have a look at the Levels dialog to clarify some items:

Input Levels - The range of values you want from the original image. The histogram represents the distribution of pixel values across your entire image from black (left) to white (right). There are three sliders just below the histogram. The far left slider adjusts where you want the darkest pixel values to be, the far right is the brightest pixel value location, and the middle slider is for gamma.

Output Levels - The range of values you want in your final image. The two sliders here are for the darkest and brightest values in your final output.

Auto, Pick Levels - The auto button, and the pick droppers for manually choosing where the different points should be in your image.

Adjustment via Sliders


Most of the time you will likely want a full range of values to be represented in your final image, so you will leave the output sliders set to the full range (0 - 255). You will make your adjustments entirely in the Input Levels portion of the dialog. You can approach this by using the histogram as a guide to where to set the sliders. The histogram is taller in places where there are a lot of pixels that represent that value. (For instance, if your image is overall very dark, the left side of the histogram will show taller than the rest).



Looking at my sample levels dialog image above, you can see that there doesn't appear to be many pixels at all in the darkest values. This is seen visually in an image as "washed out" blacks and dark values (this historgram is for the image of the trees and lane above). In this case you would grab the black point slider, and pull it to the right until you are approximately where the darkest values in your histogram begin. What you are doing here is "crushing" the darker pixels to black.

The same thing can be done for the brightest pixels by dragging the white point slider (far right) to the left. I normally leave the gamma alone unless it can produce good results. Usually it will wash out/crush the middle tones, but a slight bump in one direction or the other can sometimes help.

Adjustment via Manual Pick Points


This is a much more intuitive way of adjusting the levels in your image (and is the basis for my Color Correction tutorial). You will use the droppers to visually choose what should be the darkest/lightest/middle gray portions of your image.



The first button in this group is the "Auto" button. This will use GIMPs method of balancing the levels across your image, and will sometimes produce reasonable results. It doesn't hurt to try it as you can always undo it if you don't like it.

If it produces bad results or you just want more control, you can move on to the droppers. This is the method I will normally use most often if I'm playing with Levels only. The three droppers are for: Black Point, Middle Gray, and White Point respectively.

Each of the droppers work the same way. When you click on one, you activate it. Hovering your mouse over your current image should show your mouse pointer as an eyedropper tool. This means that wherever you pick in the image you are telling GIMP to make it either black, white, or middle gray (depending on which dropper you are using). GIMP will then adjust the levels in the image to match what you want.

If you have a point in your image that you either know is black (or want to be black), then click on the Black Point eyedropper, and click on the pixels in your image that should be black.

Now, by default, the picker will pick a sample from the pixel you choose, and will sample a radius around the pixel (3 by default I think). You can change the radius around the pixel to your liking by modifying the Radius under Sample Average in your Toolbox.

If you prefer single-pixel precision when setting a black/white/gray point, then simply un-check the Sample Average option in your toolbox. Now you can pick a single pixel to represent black/white/gray.

A final word on the gray point dropper, though. Usually you can easily find places on your photo where you expect a reasonable black or white value to be, and can easily use that as a pick point for the appropriate level. Middle gray is a little bit harder. You need to be sure that the pixels you are choosing really should represent middle gray in your image (RGB: 128 128 128). If they are not close, you will introduce a color cast in your image as GIMP will shift the RGB values to match middle gray where you pick!

10 comments:

  1. Thanks! There's still more to come, so check back.

    ReplyDelete
  2. Hi. Thanks a lot. I finally think I'll be able to understand the considerable controls GIMP offers with the help of knowledgeable and considerate people like yourself. Hope to be able to help someone the way you've helped me:))

    ReplyDelete
  3. Hey, good description of the levels function - it confirms what I've eventually come to establish through trial and error lol. I'm curious, and maybe you talk about it in a different post, but do you think it makes more sense/gives more control to adjust the levels separately for each R/G/B channel or are results likely to be better by using just the Value channel?

    ReplyDelete
    Replies
    1. Hi Mark,

      I do actually discuss adjusting RGB channels separately, but in the context of color adjustments to the image as opposed to Lift/Gamma/Gain in the Levels dialog (shown here).

      The problem with doing each channel separately is that you have to be careful, lest you introduce strange/unintended colorings to your final image (see the color curves tutorial here to get an idea of what I mean).

      Delete
  4. Hi Patrick,

    I just came across your tutorials about gimp. My question is: When do you use a rawconverter for these changes and when do you use gimp? Your results are impressive though I think you use gimp, when you don't have any raw-files.

    ReplyDelete
    Replies
    1. I'll usually leave the RAW converters for actual RAW files, and do most of my other work in GIMP. My normal workflow is to use Rawtherapee for my RAW conversion and initial editing, then export to GIMP for finishing things out.

      Delete
    2. I think, there are some examples that show 8bit in Gimp isn't enough: white balance, extreme under- or overexposed pictures (loss of details in structures).But, if I'm honest, the broken histograms are often worse than the optical impression on the screen or even on the print. - Thanks for sharing your experiences.

      Delete
  5. Hi, I'm following a tutorial, made by you, I think, to make a floating logo that I found on gimp.org. At some point I adjust the levels to increase the sharpness of the edges. After I adjust the levels to what is shown in the pictures (and seeing the result on my image), I continue my work, but then I wanted to go back and play with the levels again and I see that the Input Values that I previously set to 91 and 0.32 are back to 255 and 1.00. Why do they show the original values? Is it because now these are relative to the distribution of the levels that I made the first time?

    ReplyDelete