The Histogram Exposed

HistogramBy Ralph Tomaccio, MPhotog. Cr With excerpts from Adobe Photoshop Help

Just what is a histogram?

a) A telegram retrieved from history
b) A medical procedure
c) A silhouette of the Rocky Mountains
d) A graphical representation of data

If you chose “D”, at least you’re on the road to understanding the importance of the histogram. In my workshops and in talking with photographers who have entered the digital realm, I am surprised at how many do not fully understand all the histogram has to offer.

The histogram is probably one of the single most important items to become familiar with when working in Photoshop. For starters, it is nothing short of being the best light meter going. It can tell you if you’re under or over exposed, whether your lighting is flat or contrasty and exactly how much information you will lose with any given adjustment. It will help improve your images greatly.

So, what IS a histogram? Straight from the Help section in Adobe Photoshop comes this definition:

A histogram illustrates how pixels in an image are distributed by graphing the number of pixels at each color intensity level. This can show you whether the image contains enough detail in the shadows (shown in the left part of the histogram), midtones (shown in the middle), and highlights (shown in the right part) to make a good correction.

The histogram also gives a quick picture of the tonal range of the image, or the image key type. A low-key image has detail concentrated in the shadows; a high-key image has detail concentrated in the highlights; and an average-key image has detail concentrated in the midtones. An image with full tonal range has a high number of pixels in all areas. Identifying the tonal range helps determine appropriate tonal corrections

Using the Histogram:

1. By default, the histogram displays the tonal range of the entire image. To display histogram data for a portion of the image, first select that portion.

2. Choose Image > Histogram. The horizontal axis of the histogram represents the intensity values, or levels, from darkest (0) at the far left to brightest (255) at the far right; the vertical axis represents the total number of pixels with a given value.

Note: The histogram for an adjustment layer reflects the data for all visible layers beneath it.

3. To view information about a specific point on the histogram, place the pointer there. To view information about a range of values, drag in the histogram to highlight the range. When you are finished, click OK to close the histogram.

Statistical information about the intensity values of the pixels appears below the histogram:

  • Mean: Represents the average intensity value.
  • Standard deviation (Std Dev): Represents how widely intensity values vary.
  • Median: Shows the middle value in the range of intensity values.
  • Pixels: Represents the total number of pixels used to calculate the histogram.
  • Level: Displays the intensity level of the area underneath the pointer.
  • Count: Shows the total number of pixels corresponding to the intensity level underneath the pointer.
  • Percentile: Displays the cumulative number of pixels at or below the level underneath the pointer. This value is expressed as a percentage of all the pixels in the image, from 0% at the far left to 100% at the far right.
  • Cache Level: Shows the setting for the image cache. If the Use Cache for Histograms option is selected in the Memory and Image Cache (Windows) or Image Cache (Mac OS) preferences, the histogram displays more quickly and is based on a representative sampling of pixels in the image (based on the magnification), rather than on all of the pixels (equivalent to a cache level of 1). Deselect this option if you want to check for posterization in the image. You can press Shift while choosing Image > Histogram to generate the histogram using all pixels in the image.

In my years of involvement in digital, I can truly state that I have never had a need for the statistical information shown in the histogram window. That is not to say it is unimportant, just that I don’t feel most photographers have a need to know the statistics to benefit from the actual graphical representation. You will use the histogram more often in the Levels dialog. This is where a great portion of your color and contrast range correction will take place.

You can set the highlights and shadows in an image by moving the input sliders on both ends of the Levels histogram. This maps (readjusts) these pixels, the darkest and lightest pixels in each channel, increasing the tonal range of the image. The corresponding pixels in the other channels are adjusted proportionately to avoid altering the color balance. You can use the middle Input slider to change the intensity values of the middle range of gray tones without dramatically altering the highlights and shadows. Although the Levels sliders are not as exact as assigning target values or using the Curves dialog box, they often yield good results.

To adjust tonal range using Levels:

1. Open the Levels dialog box.

2. To adjust tones for a specific color channel, choose an option from the Channel menu.

3. To adjust the shadows and highlights, do one of the following:

  • Drag the black and white Input Levels sliders to the edge of the first group of pixels on either end of the histogram. You can also enter values directly into the first and third Input Levels text boxes.
  • Drag the black and white Output Levels sliders to define new shadow and highlight values. You can also enter values directly in the Output Levels text boxes.

For example, suppose you want to increase the contrast in an image with pixels that currently cover a range of only 0-233. If you drag the Input Levels white triangle to 233, pixels with intensity values of 233 and higher (in each channel of the image) are mapped to 255; pixels with lower intensity values are mapped to corresponding lighter values. This remapping lightens the image, increasing the contrast in highlight areas.

Suppose instead you want to decrease the contrast in the image. If you drag the Output Levels white triangle to 220, pixels with intensity values of 255 are remapped to 220, and pixels with lower intensity values are mapped to corresponding darker values. This darkens the image, decreasing the contrast in highlight areas.

Note: You can click Auto to move the highlight and shadow sliders automatically to the brightest and darkest points. This is the same as using the Auto Levels command and may be adequate for an average-key image. Because so few of our images are “average”, I do not recommend using any “auto” settings in Photoshop. They do not offer any control over the image and seldom produce an acceptable result.

4. If your image needs midtone corrections, use the middle Input Levels slider. Drag the slider to the right to darken the midtones; drag it to the left to lighten the midtones. You can also enter values directly in the middle Input Levels text box.

5. Click OK.

6. To view the adjusted histogram, reopen the Levels dialog box.

The gaps in the adjusted histogram do not indicate a perceptible problem in the image unless they are large or accompanied by a low pixel count. These gaps, or “spikes”, in a histogram represent data that has been lost. Once lost, they can never be replaced without starting over with the original image. To take using the Levels dialog and it’s histogram to a safer place for many, I highly recommend using “Adjustment Layers”. This will show you the effects of levels changes without actually affecting the actual pixels (until you flatten the image). What this allows is frequent changes to the image without the fear of losing important data. Once you are satisfied with all you manipulations, then flatten your image.

To access Adjustment Layers, go to Layer>New Adjustment Layer and select the type of your choice, in this case Levels. Or, more directly, in the Layers palette (Photoshop 6.0), click on the half black/half white circle button at the bottom (second button to the left of the Trash can).

Fig. 1 High Key/Uncorrected
You will notice that the vast majority of pixel data is to the right, highlight, side of the histogram. This is an example of a High Key image and it’s histogram which has not yet been manipulated, as shown by the lack of any pixel data to the right of the the highest peak in the highlight area (circled area). Because of this, there is no near white, or white, in this image.

Fig. 2 High Key Corrected/Corrected
After making Levels corrections and adjustments to color, flattening the image and creating a new histogram, you can see how the data has been remapped so that we now have whites with detail. I intentionally did not move the shadow slider to the right, which would have made the dark areas darker, because I wanted to keep them “open” and more in line with a high key image. This is one of the reasons why “Auto Levels” is not preferred - it takes away from our creative and subjective preferences.

Fig. 3 Average Key
This image has a broad range of tones and is representative of “Average Key”. Comparing its histogram to the others, you can see how there is substantial pixel data across the whole range of the histogram. Even though average in key, you can see a very high peak in one area (in this case, in the highlights). This is common and simply means there is a substantial number of pixels in that short range - in this case, the peak represents the white areas of the drawings on the wall behind the subject.

Fig. 4 Low Key
Obviously Low Key, notice how practically all the pixels have shifted to the left, shadow side, of the histogram. There are no pure whites, and the highlight side of the face is shown in the histogram by a relatively low amount of pixel information in the midtone (center) region.

Fig. 5 High Key/Low Key
We now know what a High and Low key histogram looks like. When we have an image that has a Low Key subject and High Key background (or vice versa) as we do here, it’s no surprise that we get an extreme amount of pixel data in the shadow and highlight areas in the histogram, with very little data in the midtones, which would be the skin tones in this case.

Fig. 6 Under-Exposed
Looking at the circled area in the shadow side of this histogram, you can easily see that we have an “Under-Exposure” situation. Data is obviously running off the scale. Can the lab correct it? No! But you can, simply by taking a quick look at the histogram in your camera or capture software and realizing what’s going on. Open up the aperture or slow down the shutter speed, capture the scene again, and confirm your exposure by looking at the new histogram. That’s one of the beautiful advantages of digital capture - instant feedback.

Fig. 7 Over-Exposure
By now, it should come as no surprise as to what a histogram for an“Over-Exposure” situation would look like. Again, once recognized, the corrective move is obvious.

Fig. 8 Lost Data Spikes
One thing to keep in mind is that digital imaging is very much like shooting transparency - under or over exposure will cause you to lose valuable information in the shadow and highlight areas. Once lost, it can never be retrieved. The same holds true when making color corrections and the main reason why I am such a strong advocate of using Adjustment layers. It allows unlimited corrections without the fear of losing important data until you flatten the image. At that point, if you did your job well, any information lost is , most likely, not harming the image ( and with almost all corrections you will loose some data). Figure 8 illustrates the “spikes” (white vertical lines) in the histogram which represents lost data.

In closing;
The art and craft of photography has never been more linked together as it is with digital. It has added to our creativity tremendously and has put the control back to where it belongs - in the photographer’s hands. Do you have to “do it all”? No. More and more labs are offering all the services always available to film based photographers. But, at least now we have the choice on a “per job” basis to either send it out or do it ourselves. It doesn’t have to be an “either/or” situation nearly as much as it had to be in the past. Thank you for taking the time to study this lesson.

Ralph Tomaccio
Korday Studio
50 Franklin Street
Framingham MA 01702-6671
508.872.3282