All about Histograms

The histogram is the one major tool that defines and empowers digital image processing. With the histogram, the scientist-artist can analyze the image for proper tonal control in an objective way, leading to more consistent results.

A brief tour of the histogram chart is in order. A histogram is a statistical chart, showing how often certain pixel values occur. It is a tally or a vote to show the most popular pixel values, just as a political election may tally the votes for each particular candidate.

By convention, all software and all cameras capable of showing a histogram will arrange those vote columns in order from pure black (on the left) to pure white (on the right). A large number of dark pixels in an image will show high peaks near the left end of the scale. A large number of light pixels will show high peaks near the right end. Examine each image on this page, and examine the histograms below them, and you will start to recognize the correlation between bright and dark images, and left and right histograms.

Some histograms are drawn with separate graphs showing red, green and blue components, overlaid. Most cameras and programs show an overall composite histogram of luminance, which is a mixture function that mimics the color sensitivities of our eyes.

What can the histogram tell us? There are four things that numerical analysis will yield. We can remember them as the Four C's: clipping, contrast, curvature, and calibration.

Clipping

The image to the right has a histogram that is clipped. By this, we mean that the scene had bright areas which were too bright to be captured at the camera's current settings.

You can see the spike of the histogram rise up sharply against its right edge, indicating that a large number of pixels are pure white, instead of many subtle shades of nearly-white. The waterfall and sky do not hold much detail which the photographer's eye could easily see. Also note the histogram has some empty space at the left, indicating there are no really dark black shadows.

Clipping is a sign of data loss. No matter how good the photo editing software, the details in the sky or water cannot be restored. The software cannot tell which whites should be medium-gray and which whites should be light-yellow, for example. It is very important to capture images which do not have a clipped histogram, so that they retain the best possible detail in all parts of the photograph.

If your camera can show a histogram of your photograph while you're still in the field, it is a good idea to check it now and then. Avoid clipping by reducing your exposure, and taking another shot. A proper exposure for most scenes will have almost no pure-white pixels, and almost no pure-black pixels. The peaks and valleys in between may vary in height and position, depending on the subject.

When adjusting your exposure, you should try to favor the right end of the histogram, but without clipping. Most electronic sensors can retain better color and tonal details in the upper half of their range. Get your image as brightly exposed as possible without getting too bright to hold all of the data. This technique is usually called "shooting right" or "exposing for the highlights."

Some scenes are very challenging because their dynamic range is too high; the brightest features are very bright, compared to the details in the shadows. You may have to accept some clipping to capture such a scene in one photograph. That leads us to talk next about contrast.

Contrast

The histogram can also give a good indication of the overall contrast or tonal range of an image. If all of the values in the histogram are bunched up, the photograph has an overall low contrast. Conversely, if there are strongly contrasting light areas and dark areas in the image, the histogram will show a wide range of tones from left to right.

It's easy to see this effect if you compare a few images. Some cameras may allow you to adjust the contrast immediately, but by experimenting with lighting, you can achieve a similar effect with any camera.

If you adjust contrast artificially, through the camera's options or with an image editor, you will also affect the richness or blandness of the colors, called saturation. Good lighting from appropriate angles can also bring out richer colors in your images, too, so experiment for the image you want.

Curvature

Not all photographs should have a histogram that ranges from far left to far right. Often, a dark image can create a somber mood or other similar feeling in the viewer. Other times, an airy and joyous mood can be expressed with glowing light tones. These biases can be adjusted with "transfer curves" functions in editing software, but a quick glance at a histogram can also give you a feeling for the mood before you see the actual picture.

Sometimes, images which use dark shades exclusively are called low key. The key light has been kept low, or the image mood is dark. Those photographs which use light shades exclusively, such as by increasing the power on the key light, are called high key.

In some circumstances, a photographer may expose the subject properly, but blow out or overexpose the background until it is a pure and flat area of solid white. Some people refer to this as a hot white background.

Calibration

Your modern camera has a light meter built inside. It checks available lighting and helps you expose the shot properly, based on the assumption that most of the image would be midrange tones.

You may also find a specialized light meter in a studio, and each flash unit may also have adjustable power ranges. When any two meters or adjustments come together, you have to calibrate them to each other. Each device may have been calibrated at the factory, but you may find different manufacturers had different results in this process, leaving you with unexpected mismatches.

If you took a photograph of a flatly lit smooth wall, with your camera's automatic metering, it should result in a histogram with a center spike. Any flatly lit smooth object would do the same, whether it is light or dark in reality. Either a snowbank or a tuxedo can look a dingy gray. Every shot is exposed as if it were gray, so every shot comes out with a middle tone.

The histogram can help you calibrate your devices to one another, and to help you calibrate your expectations to the final image. By comparing the effects of exposure settings to the resulting test shots, you might discover that your lightmeter reads a little high or low.

By understanding your device's metering, you can compensate. Many cameras let you specify a compensation value, such as -1eV or +1/2eV, to counteract those midrange assumptios. By dialing in a compensation, or by adjusting your aperture and shutter time, you should be able to make that snowbank look crisp and cool, or that tuxedo sharply black.



Contact Ed Halley by email at ed@halley.cc.
Text, code, layout and artwork are Copyright © 1996-2008 Ed Halley.
Copying in whole or in part, with author attribution, is expressly allowed.
Any references to trademarks are illustrative and are controlled by their respective owners.
Make donations with PayPal - it's fast, free and secure!