Ok, so this tutorial is going to get a little more technical and theoretical, but I promise I’ll try to make it as easy as possible. To start with I’m going to describe what the Histogram is and why you should care about it (No really, it is your friend!!). Then we are going to dive into using Levels and Curves to adjust the tonal range in an image in order to enhance it. These are the very basics of image color and tonal adjustments.
The Histogram in Photoshop is essentially the same thing that is built into the interface of most DSLR cameras. You’ve probably seen it, but may have wondered what in the world this mountain range really meant. In its most simple form, any histogram represents the frequency of occurrence of some set of information. In photography…it shows us how many pixels in our image are black, white or any tone in between. Pure black is on the left and white is on the right. For a very basic example – say you have an image that is just four pixels – a simple square with one black, one white and two gray pixels. A simplified Histogram for this image would look like this:
In Photoshop the Histogram represents the tonal value of every pixel in the image, so what you’re actually looking at is millions of little bars stacked on top of each other – each mountain peak is indicating where a relatively larger number of pixels fall in the scale from black to white. If you have a massive mountain jammed all the way to right in your histogram, it is saying that your image is predominantly composed of white or near-white pixels…which may mean it’s over-exposed.
So is that bad? Well…it all depends really. Ultimately the idea of evening out the values across the histogram is just a suggestion and it’s up to you to decide what the image should look like, but understanding what the histogram is telling you can be a huge advantage in getting your images just right. High-key photos will be mostly leaning to the right while low-key images will have a greater proportion of dark pixels. The key is that you should still have a slight amount of information in the full range and the histogram will tell you if you are losing detail in any of the extremes.
So let’s make a simple image and start to learn how Levels and Curves affect the image and its Histogram. Start by creating a new image, and make it just 3 pixels by 3 pixels. You’ll get a teensy tiny square. Zoom in on this as far as possible (hit Ctrl/Cmd + 0). Now get your pencil tool and put one black pixel in the lower left corner of your square. Next, pick a dark gray and pencil that into one pixel above and to the right of the black one. Select a medium gray and put that in the upper left pixel, center pixel and lower right pixel. Finally, using a light gray fill in the top-center and right-center pixels, leaving the upper-right pixel white. You should have a rough gradient from black to white and a histogram that has a few bars in the middle and one all the way to the left and one to the right, like this:
The bars are telling you where in the range from black to white the pixels in your image fall.
Ok, now open up the Levels dialog and let’s start to do some adjusting. Make sure your histogram window is active (Window > Histogram) and then go to Image > Adjustments > Levels. You’ll get a window that pops up with the Histogram in it and a few sliders along the bottom called Input Levels. You’ll also see a gradient bar with two more sliders that is called Output Levels. There’s also a Channels drop box at the top that we aren’t going to worry about for now (this basically lets you work on one color “channel” at a time). Grab the black slider underneath the histogram and slowly move it to the right while watching your image. You’ll see the gray boxes gradually grow darker. As you cross the first bar in your histogram, the two pixels next to your original black pixel have now become black. Cross the center bar and the diagonal row of gray pixels turns completely black. Keep going and eventually you will be left with just one white upper right pixel and everything else is black. Slide that back all the way to the left and then move it back to white again while watching your histogram update in the other window. You should see the gray bars slowly marching their way toward black. Return that slider to the left side and now grab the white slider. As you move this to the left the opposite happens – your gray boxes start to turn white!! Return that to the right side and pick the gray slider in the middle. As you move this left or right the grays shift darker or lighter and your histogram bars will cluster to the right or left, but you still keep the pure white and black pixels the same.
So what’s that really doing? Well, those sliders tell Photoshop where to “map” black, white and middle gray in your image. If you open an image and it looks just mostly gray, you probably don’t have many black or white values, and pulling the sliders in essentially stretches the tonal range of the image to include more black and white (you’ll see this in the example image soon). Moving the gray slider will brighten or darken the image without destroying your shadows or highlights.
The output sliders at the bottom have a slightly different effect. If you experiment with them you will note that they actually reduce contrast and fade the black or white values. If you slide the black slider left, your image will be all very light grays and white. I honestly very rarely use the output sliders except for a few very particular cases. Finally, you will notice there are three little “eye-dropper” tools in the Levels window. These are useful for quickly picking in your image where the black, middle-gray and white points should be. Pick the white eye-dropper and click on the center middle-gray pixel. You will see that all the middle gray and lighter gray pixels are set to white. If you click back on your original white pixel in the upper-right everything returns to normal. Go ahead and experiment with the eye dropper tools noting the changes that occur when you pick different points.
Ok, cancel out of Levels and let’s try Curves. Go to Image > Adjustments > Curves. You’ll get another window with a diagonal line across it. This line is really just a graphical representation of the Levels you were just playing with. The output levels are your vertical axis and Input is the horizontal axis. White is the upper right point and black is in the lower left. You’ll also notice the same three eye-dropper tools. Make sure the Preview box is checked and then pick your white point and slide it to the left. You’ll see the same effect as when we moved the white slider in the Input section of Levels. Moving it down has the same effect as the Output Levels. Now pick a point in the middle and it creates a little box that you move around. Raise it up just slightly. This is the same as sliding the middle gray slider in Levels to the right – increasing the brightness of the image while retaining your white and black points.
When you’re through experimenting, try creating a simple “S” curve by slightly raising the highlights and decreasing the darker tones like this:
You’ll see that the contrast in the mid-tones has increased while your black and white points remain the same. If you flip the curve by raising your dark tones and lowering the highlights the contrast will be decreased. Cool stuff…
So enough messing around with little gray pixels…let’s try it on a real image! Load up the pole-vaulter picture at the bottom of this tutorial and convert it to grayscale (Hint: use an adjustment layer! Pick the split circle icon at the bottom of your layers window, select Hue/Saturation and then slide the Hue slider all the way to the left). You’ll notice that the histogram has a large amount of darker tones, but there is no black or white…everything is some value of gray (it was a hazy, overcast day when I took this shot).
Let’s start with a Levels adjustment to expand the tonal range of the image (giving it full black and white values). Create another adjustment layer and select Levels. In the window pull your black slider to the right. As you go further to the right you’ll notice more and more of your image turning black until there’s nothing but the number card left. We really just want a hint of some black so leave it at a point where there are just a few pixels that have turned black (if you look at the number boxes I set mine at a value of 22). Now pick the white slider and bring it down until you just start to get some white pixels (I stopped at 233). Finally, you can use the middle gray slider to brighten or darken the image over-all. I tend to like darker images so I left it as-is. Click OK to accept the changes – Nice!! If you want to compare this to the original black-and-white image just click the little eyeball icon in the left column of your Levels adjustment layer. If you toggle this on and off you can see how the image has a fuller range of tone and the histogram also expands to fill the whole range.
Ok, now say you want to make this a little more contrasty…really simple. Create a third adjustment layer and pick Curves. Now just boost the highlights and pull down the dark tones creating the same “S” curve that we did in the earlier exercise. Presto! Feel free to experiment with the curves settings. You can add up to 15 points on the curve to adjust (I really can’t remember ever creating more than three or four…). When you’re used to how this works you can really do all the adjustments just within the Curves settings, but I wanted to show you how each tool could be used.
When you’re happy with the way it looks, just for grins turn off the Hue/Saturation layer to see what this did to the color image. Whoa!!! You will probably see some pretty extreme color changes like bright red-orange legs. Curves adjustments do have one little tricky point – they will cause some color shifting and the more extreme your changes the more noticeable this is. The nice thing about adjustment layers is that if you want to change your settings, just double click on the layer thumbnail (the “graph box” part, not the title) and you can make new adjustments. What may have looked good in black-and-white will probably be too extreme for a full-color photo.
Now that you have all these corrections done in adjustment layers, what if you wanted to do something like add a filter? You can’t really do this effectively to all these layers, so you need to “apply” this image to a new layer. Create a blank layer and then go up to Image > Apply Image (the keyboard shortcut for this is a little involved – Ctrl + Alt + Shift + E, or Cmd + Opt + Shift + E). This creates a new top layer with all your adjustments applied to it. You can then edit this the same way you would any regular image layer.
Alright! Hopefully you’ve got a good grasp of what the histogram is telling you about your images. One easy way to keep learning how this works is to load up some of your favorite pictures and see what their histograms look like. It doesn’t need to be a super high-quality image either…find some online that just have a good high or low-key look and see what their histograms reveal.
Original Pole-vault Image:
One thought on “Demystifying Levels, Curves, and the Histogram”
Easy read; great article on what histograms are…wish I had someone explain it to me like this years ago…