Histogram

Vincent Bockaert, 123di.com

Histograms are the key to understanding digital images. This 10x4 mosaic contains 40 tiles which we could sort by color and then stack up accordingly. The higher the pile, the more tiles of that color in the mosaic. The resulting "histogram" would represent the color distribution of the mosaic.

In the sensor topic we learned that a digital image is basically a mosaic of square tiles or "pixels" of uniform color which are so tiny that it appears uniform and smooth. Instead of sorting them by color, we could sort these pixels into 256 levels of brightness from black (value 0) to white (value 255) with 254 gray levels in between. Just as we did manually for the mosaic, an imaging software automatically sorted the pixels of the image below into 256 groups (levels) of "brightness" and stacked them up accordingly. The height of each "stack" or vertical "bar" tells you how many pixels there are for that particular brightness. "0" and "255" are the darkest and brightest values, corresponding to black and white respectively.

On this histogram each "stack" or "bar" is one pixel wide. Unlike the mosaic histograms, the 256 bars are stacked side by side without any space between them, which is why for educational purposes, the vertical bars are shown in alternating shades of gray, allowing you to distinguish the individual bars. There are no blank spaces between bars to avoid confusion with blank spaces caused by missing tones in the image. Normally all bars will be black as indicated in the second histogram.

Typical Histogram Examples

Correctly exposed image
This is an example of a correctly exposed image with a "good" histogram. The smooth curve downwards ending in 255 shows that the subtle highlight detail in the clouds and waves is preserved. Likewise, the shadow area starts at 0 and builds up gradually.
Underexposed image The histogram indicates there are a lot of pixels with value 0 or close to 0, which is an indication of "clipped shadows". Some shadow detail is lost forever as explained in the dynamic range topic. Unless there is a lot of pure black in the image, there should not be that many pure black pixels. There are also very few pixels in the highlight area.
Overexposed image The histogram indicates there are a lot of pixels with value 255 or close to 255, which is an indication of "clipped highlights". Subtle highlight detail in the clouds and waves is lost. There are also very few pixels in the shadow area.
Image with too much contrast This image has both clipped shadows and highlights. The dynamic range of the scene is larger than the dynamic range of the camera.
Image with too little contrast This image only contains midtones and lacks contrast, resulting in a hazy image.
Image with modified contrast When "stretching" the above histogram via a Levels or Curves adjustment, the contrast of the image improves, but since the tones are redistributed over a wider tonal range, some tones are missing, as indicated in this "combed" histogram. Too much combing can lead to posterization.

Keeping an Eye on the Histograms when Taking Pictures

Example of camera histogram review with overexposure warning

Most prosumer cameras and all professional cameras allow you to view the histogram on the camera's LCD so you can adjust the exposure and take the shot again if necessary. Some cameras come with an overexposure warning, whereby the overexposed areas blink, as indicated in this animation. Usually the blinking areas indiate that at least one of the channels is clipped.

Keeping an Eye on the Histograms when Editing

When editing images, it is important to keep an eye on the histogram to avoid the above mentioned shadow and highlight clipping and posterization. Adobe Photoshop CS and later versions come with a live histogram palette, as stated in my Photoshop CS review.

Summary

It is essential to keep an eye on the histogram when taking pictures and when editing them to ensure proper exposure and avoid losing shadow and highlight detail.

This article is written by Vincent Bockaert,
author of The 123 of digital imaging Interactive Learning Suite
Click here to visit 123di.com