Digital Image Histograms

Histograms are excellent tools for evaluating image exposure and contrast.  

If you are new to reading digital histograms, this article may help you understand them.   Much has already been written about how to recognize the so-called perfectly composed and exposed scene.   But this can lead to a mistaken impression that there is one basic shape that describes a good image.   I will use some extreme images to show that is not always true and illustrate what I believe one should really be looking for.

The Basics

Basically, a histogram is simple a bar chart.   The horizontal axis (x) is the brightness value for pixels.   The darkest possible black (0) is to the left and the brightest white (255) is on right.   The vertical scale (y) shows the relative number of pixels in the image having the brightness value that corresponds to that position on the horizontal axis.   Both axis scales are compressed to fit within an available screen or window.   This necessary compression on the vertical axis can make interpretation of details more difficult.

Figure 1

The horizontal axis shows the luminescence (darkness/lightness) of the tones.   The far left indicates how many pixels represent dark shadow details, the far right indicates how many pixels represent bright highlight details, and the middle represents the distribution of mid tones.   This scale does not indicate how many different tones are represented in the image.   The bit depth of the image determines that.   For example an 8 bit image has only 256 tones for each color while a 12 bit image has 4096 tones for each color.   Nor does this illustrate the accuracy of the tones captured in the image.   That is determined by the efficiency of the capture device sensors to the range of tones and colors it can faithfully detect and record.   All histograms show a compressed representation of the actual image tones.   A graph that does not extend far enough to the left and right indicates a loss of contrast (flare or haze).   One that extends too far right or left indicates that some highlight or shadow details may have been lost.  

The vertical axis is scaled so that the greatest value doesn't run off the top of screen.   The maximum vertical value does not indicate any clipping has occurred.   There will always be at least one tone, and possibly more, which fills the vertical scale.   The actual height of the individual bars is based on the distribution (frequency) of pixels by tonal value, not the intensity. Consequently a solid background tone may make the subject tones appear as only small bumps along the baseline.

The overall shape of the curve displayed is the most important attribute.   But, there is no single shape that will fit all images.   That is determined by the tonal content of the image.   It can be very different for a high key or low key scene.  Thus, I decided to show some of these extremes here.   These do not represent typical shooting conditions, but they do help to understand how to interpret histograms better.

There are several places in the digital workflow that histograms can be displayed.   The cameraís LCD is most important in the field for an initial check.   Due to the axis scaling it will not always clearly show blown highlights.   It is advisable to use the blinking highlights preview as well if it is available on your camera.   If you are shooting digital RAW images, there is also a histogram shown as the image is being opened.   This is excellent for evaluating exposure and contrast adjustments.   Along with the exposure and shadow sliders you can even see where in the image any clipping is happening.   Adobe Camera Raw shows the histogram with the primary colors overlaid.   This can be useful to validate the white balance if you shoot an image of a gray scale target.   Then, there are the histograms in Photoshop or your favorite image-editing program.   They can even be displayed for the individual color channels.   These are very useful for fine adjustments during post processing using the levels and curves tools.


High Key, Low Key, or Mid-tones?

Figure 2 below shows several different images and their resultant histograms.

Figure 2

  1. A high key (white on white) image should show all tones on the right.   Note that the light tones fill the vertical scale.   The broad tonal range indicates that both the white image and the white background contain image detail.  
  2. A low key (black on black) image should show all tones on the left.   Note that the dark tones fill the vertical scale.   The broad tonal range indicates that both the black image and the black background contain image detail.  
  3. This black on white image shows some horizontal compression on the right.   There are very few light tones and in fact the highlights have been saturated as indicated by the vertical bar on the extreme right.   The white background has very little detail.   The black subj3ect has also lost some detail.  
  4. This white on black image fills the vertical scale on the left, but this area is horizontally compressed indicating that there is very little tonal information in the dark area.   That is, the background has no detail.   There are more than enough light tones, but the black background has overwhelmed the vertical scale.  
  5. This is with both bears on a black background.   The histogram is similar to Image 4 but to increase the tonal range in the black bear, the exposure had to be increased slightly.   The left side of the histogram is slightly wider and the right side is slightly narrower.   Again, black has overwhelmed the vertical scale.   The image itself is evidence that there is less detail in both of the bears.  
  6. This is the same as Image 5, but a green bear has been added on a deep green background.   Now the histogram peaks in the mid-tones.   The midtones have overwhelmed the vertical scale of the histogram.   But, both the black and white bears still have tonal detail.  
  7. The histogram in the Fuji S2 preview LCD screen.   Note that the horizontal axis is divided into four zones.   These markings can be very useful for bracketing exposures.   The S2 preview histogram may be set to show a single color channel or all three, but it still shows a monochrome histogram.  
  8. The histogram in the D1X preview LCD screen.   Again, the horizontal axis is divided into four zones.   The histogram itself is larger and easier to read.  
  9. The histogram from the Photoshop ACR file open dialogue shows the separate color channels (RGB) as color overlays.   Sometimes this can indicate a warning of white balance problems, but it cannot be used effectively unless the image is a true gray scale.  

Figure 3 below shows a gray scale image.

Figure 3

This example was included only to demonstrate the fact that histograms can help in analyzing some color problems.   This is a 12 bit photographic image.   Thus it contains 4096 tones per color channel and represents seven billion unique colors.   Thus the histogram display is highly compressed.   The first histogram shows a color shift at the cameraís auto white balance setting (5050K).   The second histogram shows the resulting histogram after adjusting the white balance (4675K).   The remaining traces of color are due to a combination of optical chromatic aberrations and the extremely fine detail lines in the resolution test chart.   The third histogram shows the results of using the Photoshop levels tool to increase the image contrast.   Note that there are much better and easier to use tools for validating and correcting color balance.


One Image, Multiple Histograms

Figure 4 below shows a checkerboard (graphic) image with 24 discrete color tones similar to a color checker chart.   This turned out to be a very enlightening experiment.

Figure 4

This graphic demonstrates several potential artifacts of a typical histogram and several new tool options available with Photoshop CS histogram displays.   First, there are only 24 unique color tones in the image.   However, the initial histogram shows many more and it does not show an equal count for each tone.   This is because the 24 colors represent 72 different tones.   This 8 bit image contains 16 million potential colors, but these have been compressed to 256 tones to fit into the histogram.   After rounding the numbers several different colors occupy the same tonal value.   Hence the distinct jumps in the vertical scaling.   The compressed scale of histogram 1 shows 46 discrete tones, ten of them represent multiple colors.

For the second histogram (2) I elected to view the luminosity only.   For this the color information is discarded and only the remaining brightness value is plotted.   This results in 256 brightness values that do not need to be compressed.   So the shape of the curve has changed dramatically.   This is the most accurate histogram for evaluating exposure.   Unfortunately, it is usually not the default and may not even be offered as an option.

I also elected to show the histogram statistics.   This shows the counts and statistical information for all or selected portions of the histogram.   Here it shows 5 million pixels in the image and 450 thousand of them at brightness level 138.   This is twice the number for any other level.   Note that the cursor is sitting over the line for brightness 138.

The mean is the average value (brightness) of all pixels.   The median is the value where half of the pixels are darker and half of them are lighter.   The middle of the scale is 128 of course.   The standard deviation is a statistical number that indicates the variability in the tones.   A small standard deviation means that the range of tones will be close to the mean (steep curve), while a large standard deviation means that the values will wander far away (broad curve).   Low numbers (<30) typically indicate a lack of tonal range.   High numbers (>90) typically indicate extreme contrast like black on white.   A typical scene with good tonal range will have numbers between 40 and 60.

You can also use the Photoshop levels dialogue to locate the areas in an image where the highlights or shadows are blown.   Hold the Ďaltí key while moving the left or right sliders and watch the preview screen.

The final histogram (3) is in color and each of the three (RGB) channels is shown.   Once again, the overall shape of the histogram has changed.   We still have 16 million potential colors.   Now the horizontal scale has to show three levels for each luminescence (brightness) value.   In essence, the brightness has to be compressed to 85 discrete values.   Note that each color channel shows a unique histogram shape.


Some practical examples

Different cameras sometimes have different histograms.   Most will show only luminosity.   This is what you want to judge exposure.   Some show tones.   Some will show tones overlaid with colors.   If you are going to use the histogram in the camera, be sure that you understand which mode it is operating in.

Here are two histograms from two different images shot by a friend of mine.   The camera is unimportant and the name of the photographer is unimportant since this is not an analysis of camera fidelity or photographer competence.   In fact, Iím not even going to show the images, just the histograms.   These are from Photoshop, but they match those shown in the camera previews.

Image One    Image Two
  

Image one shows significant blown highlights and lots of shadow tones.   But it is hard to see the real problems until you have the metrics available in Photoshop.   At level 254 you now see that 8% of the image is blown highlights.   In fact, 60% of the pixels are in the deep shadows.   Fundamentally, this scene exceeds the dynamic range of the camera.   This is an image of two exotic beverages on a bar.   It was shot close up with a flash.   The foam in the beer glass and the white napkins on the bar are totally blown.   There are spectral highlights on the cocktail glass that looked interesting in the preview.   The background is unintelligible, but who cares?   But the screen or print images are trash.   The highlights cannot be recovered!   Attention to normal photographic exposure techniques could have produced a stunning product image.

Image two looks like there are significant shadow and highlight details missing.   The histogram does show some very minor blown highlights, but close examination reveals that these are less that .01% of the image and in unimportant details.   Fundamentally, the scene did not have as much dynamic range as the camera was capable of capturing.   If you reduce the exposure you will get more shadow detail but you will compress some of the highlight detail.   If you increase the exposure you will get some more highlight detail, but you will distort the shadows and create some possibly significant tonal shifts in the middle.   Lose, lose.   Unaltered, the screen or print looks a little fuzzy and muddy.   This was a wide-angle scene of an airport tarmac with terminals in the background and planes on the runway.   Again, the preview image looked cool.   The answer is to increase the contrast a little with Photoshop levels, curves, or whatever floats your boat.   The result is a stunning, sharp, all around pleasing photograph.   The camera in P mode chose an EV of 14.5.   It was noon on a clear sunny day, about as close as you can get to the sunny f/16 rule.   This was exposed correctly.

The bottom line is that if you can see vertical ridges at both ends of the histogram, you might consider reducing contrast.   If you can see horizontal flatness at both ends of the histogram, you might consider increasing contrast.   The scene and your artistic intent should be your guide.

My friend's camera was brand new that day.   Five mega-pixels, point and shoot for less than $350 and it fits in his shirt pocket.


Conclusions

We need to spend as much time analyzing the scene that forms the image as we do analyzing the histogram formed by the image.   If we try to set our exposure from the shape of the histogram alone, we're more likely to get it wrong than right.   That is exactly why I did not base this article on some sample images of landscapes, portraits, commercial products, nature, or events.   There is no such thing as a bad histogram, only bad exposures.

In fact, it is possible to have a histogram with spikes at both ends indicating clipping in both the highlights and the shadows.   An afternoon, outdoors wedding on a bright day would be a classic example.   The scene contains too much contrast, deep shadows in the trees and bright highlights in the sky.   You can address shadows on the subjects with fill flash, but it's impossible to control the distant sky and trees.   You need to ignore the extreme tones and concentrate on exposing the subjects and their attire correctly.   This is addressed by the zone system, not just a histogram.

Properly used the histogram preview on the camera can assure you that you have captured the tonal range that is most important to the image.   It primarily assures you that the exposure is reasonable and you havenít irretrievably lost the highlight or shadow tones you want.   Shooting in RAW format allows additional fine-tuning with the histogram as a guide as the image is being opened.   Image editing software (Photoshop) can then be employed to fine tune the local contrast or emphasize a desired tonal range.

So, what should we be looking for?   The quick checks are:

Interpreting the histograms can be as simple or as complex as you want to make it.   To show every possible tone and pixel count would require impossibly large display screens.   Even then, the data would be impossible to comprehend.   So, there are multiple techniques for compressing the display.   Each produces a different fundamental curve and describes different image attributes.

I hope you enjoyed this article.   When you see something unexpected it may encourage you to rethink your image objective.   Misinterpreting the relationship between the histogram and the image might cause you to discard a perfectly exposed picture.   Interpreting it correctly can help you achieve the effect you want.   If you have any comments, or suggestions, I would welcome your input.   Please send me an  Email.   Read more about ETTR or Tones and Zones.


Rags Gardner
Rags Int., Inc.
204 Trailwood Drive
Euless, TX 76039
(817) 267-2554
Send Email
www.rags-int-inc.com
January 29, 2004

This page last updated on: Saturday December 08 2007
You are visitor number 24,239 since 02/04/04