Stretching the Histogram

So far what we have is a static representation of the pixels in this digitized image. To understand how digital editing software tools use histograms to manipulate the contrast of digital photographs, and how all of this relates to digital exposure, begin by imagining that you are trying to reproduce a smooth, continuous gradation by drawing thin lines of tonal values on a strip of rubber. (If you think of each line as a pixel tonal level this becomes a very good analogy.)

If you use enough lines of tone and apply them very carefully, it's possible to create a convincing illusion of seamlessness.

FIGURE 87 Digital gradation on a rubber strip.

If you then wanted to increase the representational contrast of this gradation by making the lighter end white so that the two edges of this gradation were further apart, you could think of this as "increasing its dynamic range." The simplest way to do this would be to stretch out the rubber strip as far as you wanted it to go.

FIGURE 88 Rubber digital gradation with its contrast increased.

The contrast of this gradation is now greater. But notice that, because the rubber gradient has been stretched, this has the effect of separating the individual lines of the gradation and breaks up the illusion of continuity. The inherently digital nature of the representation is suddenly revealed.

Expanding and compressing the contrast of digital images is one of the basic functions of pixel-editing software, and when these gaps appear between pixel tonal levels in a digital photograph it's called "banding" or posterization.

FIGURE 89 Digital banding.

FIGURE 89 Digital banding.

Learning how to minimize this effect is an important skill for digital photographers who are trying to optimize the quality of their work.

Photographic film has no problem reproducing continuous gradations and increasing and compressing their contrast because they are seamless by nature. (Film grain isn't a factor in this discussion because even a grainy gradation still progresses from one tone to the next in a continuous, but grainy, way).

Using this illustration as a guide, the two fundamental principles that help to minimize banding makes intuitive sense:

1. First consider that the more lines you are able to draw on the rubber strip, the more even and continuous the result will be and the more stretching it can tolerate before banding appears. Higher bit depth images are much easier to edit without compromising their quality.

2. The less you stretch the rubber strip, the more the illusion of a continuous gradation is preserved.

I mentioned earlier that black-and-white JPEG 8 bit digital images allow for pixels to be any of 256 different tones from black to white. But camera raw photographs can easily be converted into 16 bit images where each pixel can be any one of 65,536 levels of tone or color! This means that you will have 256 times the number of pixel levels to work with and this makes avoiding banding much easier. See Appendix C for more on bit depth.

The second principle has direct implications for how digital images should be exposed. Here's how this works.

Our rubber gradation illustration makes it clear that the more you stretch out the tonal values of your subject, the more the image is degraded into noticeable digital bands.

The following illustration demonstrates the relationship this principle has to exposure in digital cameras.

Figure 90 shows an example of what happens when you underexpose an image that has average contrast with a digital camera.

Note: I made no contrast adjustments during the conversion from the camera raw state of the image and performed a simple translation of the original color image to an 8 bit grayscale file so that the tonal values will be consistent with my rubber strip gradation example.

FIGURE 90 Histogram of underexposed digital image.

Because this image is underexposed, most of the pixels are clustered to the left of the histogram and the pixels that represent the lightest tonal values of the image are near the middle of the scale.

In Adobe Photoshop's Levels Command the white, black, and gray sliders allow you to change the value of an image's pixel levels in the following way.

When you move a slider to a given pixel level in the histogram, you are essentially telling the software to change that level to either white (level 255), black (level 0), or middle gray (level 128). This depends on which slider you are moving.

Think of the pointers as grabbing the pixel level it is set to and literally dragging it to either the extreme right, left, or middle of the histogram. All of the other levels in the histogram are either stretched out or compressed in relationship to these adjustments.

The preview of the image updates itself in real time to give you a sense of how the adjusted image will look.

Figure 91 illustrates a typical contrast adjustment process. The first step would be to slide the white pointer to the left until it's under the pixel value you want to be the lightest tonal value in your image.

FIGURE 91 Histogram of underexposed digital image w/Levels adjustments.

In this case moving the white point slider to pixel level 141 gave the image a good range of contrast in the preview. When I click "OK" to accept this adjustment, pixel level 141 will be dragged to the right and reset to level 255. This is called "Setting the White Point."

I also adjusted the black and middle gray pointers until the image's contrast looked correct.

With this adjustment, the Levels Command stretches or compresses all of the other pixel values of the image so that they fill the complete range of tones from black to white. Figure 92 is the result.

Underexposed Negative Image
FIGURE 92 Histogram of underexposed digital image after Levels adjustments.

There are two important things to note about this example.

First, notice that when the contrast of this image is expanded, gaps appear in the histogram that indicate tonal values that aren't present in the image. Before I made this adjustment all of the pixel levels were clustered together and the image values were more continuous. Now that the contrast has been expanded there are gaps and the digital nature of the image is more obvious.

Figure 93 shows a detail of the effect this has on the shadow areas of this illustration.

FIGURE 93 Detail of banding in an underexposed digital image.

This image was shot at ISO 200, so what looks like noise in this shadow area is actually the loss of pixel levels or banding.

Some degree of banding is inevitable when you edit digital image files, but minimizing this effect is the key to achieving the best quality in your work.

The second thing to notice in Figure 92 is that the banding effect is greatest in the darkest tonal values of your image. There are far more gaps on the left side of the gray pointer in the middle than on the right side.

The shadow values suffer the most from this process because fewer pixel levels were devoted to them in the first place. The reason for this problem is explained later in the section The Problem of Digital Shadows, and in Appendix D.

Digital Cameras For Beginners

Digital Cameras For Beginners

Although we usually tend to think of the digital camera as the best thing since sliced bread, there are both pros and cons with its use. Nothing is available on the market that does not have both a good and a bad side, but the key is to weigh the good against the bad in order to come up with the best of both worlds.

Get My Free Ebook

Post a comment