Demystifying Levels, Curves, and the Histogram

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: Image

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:Image

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:

Image

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:

Image

3 simple photo enhancements

Focus, Vignette and Sepia – three simple effects to enhance your photos.

This tutorial will delve a little deeper into working with layers while giving you three really simple but cool effects for getting creative and artistic with your photos. A very popular portrait technique has been to use a filter that creates a blurred edge effect with a focused center. I know some photographers who created this by smearing ring of petroleum jelly around a UV filter on the front of their lens. Well, Photoshop can give us a much less messy way to achieve this look. In addition to the blurred edges (sometimes called a focus vignette) we’re going to darken them as well and then finally give the image an overall sepia-tone treatment.

My cat, Copper, was more than happy to curl up and strike a pose for this project. Now, personally I love this image pretty much as it is, but I also like to create different looks depending on the project I’m working on. So let’s get a little creative with this one.

  1. Load up the original image from the end of this post (or one of your own if you have something you want to play with). Start off by duplicating the background layer (Ctrl/Cmd + J). Go up to the top of your toolbox and select the elliptical selection tool. In the tool settings along the top enter in a value of about 40-60 in the “Feather” box (the bigger the number, the more gradual your effect will fade out of focus). Then draw a nice big circular selection around Copper’s fuzzy face. If you’re not familiar with the “Feather” effect this is simply making your selection have soft faded edges rather than a sharp line. To actually see what this looks like, go over to your toolbox and just under the foreground/background selection boxes there are two buttons. The one on the right is a dark rectangle with a hole in it that lets you “Edit in Quick Mask mode”.
    Quick Mask

    Click this and you will see that your selection turns into a “mask” like the image to the right. The selected area shows normal while the area that is not selected has been highlighted in red – the same as when we use layer masks to hide part of a layer. This functions the same way as the layer mask in that you can edit it with a black or white brush, gradient, etc. Once your selection looks right it will need to be inverted since we want to blur the edges, not Copper’s face! Go to Select > Inverse and you’ll see the selection flip.

  2. Now go up to filters and select Filter > Blur > Gausian Blur. Pick a good amount of blur – it’s ok if you think it might be too much because you can use the opacity settings on the layer to reduce this effect later if you want. I chose 8.5 pixels. Apply the filter and adjust the layer transparency to get the amount of blur you want.
  3. Viola! Can’t get much easier than that…nice blurry edges! Don’t turn off your selection just yet though (if you did, undo it!!) Let’s darken those edges just a bit to enhance the vignette. Create a new layer (click on the folded page button at the bottom of the layers window). Now grab the paint bucket and fill the selected area with black. You should get a solid black edge fading to a transparent center.
  4. To make this effect really work we need it to be more subtle. One of the most powerful features of layers is Blending Modes. These can be accessed at the top of the layers palette where you see the word “Normal” with a drop arrow next to it. Click there and you’ll have a big menu of options. Play with this as much as you want…with simple black layer we have right now many of them won’t look any different, but there are few options that will give a good look here depending on the image you’re working with. Overlay and Soft Light are two really good ones and if you want to reduce the color in the edges Hue, Saturation and Color at the bottom of the list will all have that effect (with a simple black layer like what we have here). For this image I picked Soft Light and then reduced the transparency of the layer to 78% (the shadows were just a bit too dark for my taste J). One little trick here – to quickly scroll through the different layer blending modes without clicking on each of them,  go up and pick the Move tool from the toolbox and then double-click in the blending modes box so that it’s highlighted but not expanded. You can then use the up and down arrow keys to browse the different effects and see how they impact your image. Oh, and if you would rather have the vignette make the edges lighter – you want it to be white instead of black. Go up to Image > Adjustments > Invert. You may need to readjust the blending mode and transparency to get the look you want.
  5. Now to create a nice sepia-tone look we’re going to dive into using special layers known as Adjustment Layers. These nifty little things allow you to enhance the image you’re working on without actually altering anything permanently. If you were to boost the brightness and contrast of a picture by just applying it the image, you’ve changed the pixels in the image and if you decide to change this later you may run into some problems with degrading the image – if you boost brightness to the point where you lose some highlight detail, you won’t be able to get that back!!! With an adjustment layer you can change this at any time without these worries because the main image layer stays just the way it is. So without further ado, look down at the bottom edge of your layers palette and pick the split dark and light circle to create a new adjustment layer. In the menu that pops up select Hue/Saturation. To tone the entire image you want to select the “Colorize” check box and then slide the Hue slider until you get a nice brown color (36). Bring down the Saturation a bit to 31, and the Lightness to -4. These are just the numbers that I liked…feel free to experiment and make your image as crazy as you want it to be. Copper probably won’t mind if you really want to make him a purple kitty.
  6. The image looks pretty neat just like this but I wanted to make it a little more bright and airy looking. Let’s create another adjustment layer, but this time select Levels from the menu. You might wonder why I didn’t go with Brightness/Contrast…well, without getting into too much technical stuff, Levels gives you better control. Just boosting brightness will cause a loss of depth in the shadows and blown-out highlights because it increases the brightness of ever pixel by the same amount. With Levels, you can keep the black and white points the same while boosting or reducing the mid-tones. In the Levels window, pick the grey slider in the middle just below the histogram and slide it to the left. You can also just type in a number in the center “input Levels” window. My choice was 1.94 but feel free to play with this to get the look you want. It might seem a little counter-intuitive to slide the pointer to the left in order to brighten the image. What this is doing is telling Photoshop to change the point where mid-grey is relative to pure black and white. If you move middle grey to a point closer to black, more of the remaining tones in the image will be toward the white side and vice-versa. I’m sure there’s a more technically correct way of saying that, but Copper didn’t know what it was so I’ll have to get back to you on that…
  7. Remember I said that you could go back and change these adjustment layers anytime???  Just double-click on either of the adjustment layers and you’ll see the corresponding dialog window open up again with the settings you selected right there. You can also see the original image anytime just by clicking the little eye icon in the layer to turn it off. Pretty cool stuff!!

Here’s the original image for you to play with:

Original Image

Blog at WordPress.com.

Up ↑