If you’ve done much photography at all, you probably know that your in-camera exposure meter, while being a wondrous mechanism much of the time, can sometimes fail you and the result is an under- or overexposed image.
If you want to get a handle on the exposure that your camera is giving you and be able to better control the outcome up front, it’s worth your while to learn a bit about histograms.
You’ve probably seen a histogram, a small lumpy looking graph, when you’ve previewed a photo on your camera’s LCD screen or maybe when you’ve edited an image in photo editing software such as Photoshop.
But what exactly is a histogram?
Well, if you will indulge me for just a moment as I channel my inner geek…
Histograms were originally developed by mathematicians to visually depict the distribution of values over a range. Outside of photography, histograms can be used to show the distribution of things such as grades in a class, incomes in a neighborhood, or people’s heights.
Now this may sound confusing, but it’s actually a pretty simple concept. Let’s look at an example.
Say we have a group of male teenagers and we want to develop a histogram of their heights. So we measure everyone’s height in inches and keep track of those measurements.
Here’s our data.
64, 65, 65, 67, 67, 68, 68, 63, 64, 64, 65, 65, 65, 65, 66, 67, 68, 68, 68, 66, 66, 68, 68, 69, 69, 71, 65, 65, 66, 66, 68, 70, 74, 64, 66, 67, 67, 67, 67, 68, 68, 69, 69, 69, 69, 70, 71, 71, 75, 62, 63, 64, 64, 66, 68, 69, 69, 70, 70, 71, 74, 62, 64, 65, 65, 67, 67, 68, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 71, 72, 63, 66, 66, 66, 67, 67, 69, 70, 71, 72, 73, 63, 63, 67, 67, 68, 68, 68, 69, 69, 71, 72, 67, 68, 68, 70, 64, 68, 69, 70, 66, 67, 67, 68, 70, 72, 63, 64, 66, 66, 67, 67, 67, 68, 70, 72, 73
This gives the following data of frequency of heights of our group of teenage boys:
|Height in Inches||Frequency|
And if we graph this data in the form of a histogram, we get the following.
On this graph, the height goes along the horizontal line and the count of each of these, the number of boys with that height, shows along the left vertical axis. And, so, from this graph we can quickly see the distribution of heights within our group of teenagers. We can see how many have a height of 63 inches, how many have a height of 64 inches, of 65 inches, etc. And we can see that the most common height is 68 inches.
This same idea applies to histograms in photography. In photography, histograms show the distribution of luminance—the brightness values—for the pixels in a photo. Brightness values range from 0 for completely black to 255 for completely white and covers all shades in between. So medium gray has a brightness value of 128.
The luminance histogram shows how many pixels have a brightness value of 0, how many have a value of 1, a value of 2… and so on, showing the number of pixels at each brightness value up to the maximum of 255.
To see how this works, let’s look at a couple of examples.
Consider the illustration below. It’s a very basic image consisting of just three shades—black (with a luminance value of 0), mid gray (with a luminance value of 128) and white (with a luminance value of 255). You can see that about 25% of the pixels in the image are black, about 25% are mid gray and the rest, about 50%, are white.
The histogram for this image would look something like this:
In the graph above, the luminance values show along the horizontal line with the numbers going from 0 (black) at the far left to 255 (white) at the far right. The height of each bar represents the number of pixels of each luminance value. It’s easy to see from the histogram that the majority of pixels within the image are white.
Here’s another example, this one with five luminance values.
And the corresponding histogram:
As before, this histogram shows the number of pixels of each luminance values. Again here you can see that the dark areas of the image are represented by the luminance values showing toward the left side of the histogram.
Now, in the real world, photographic histograms don’t look like these simplified bar graphs because real photographs have hundreds of thousands of pixels and, within these pixels, most of the range of luminance values are usually represented.
For example, consider the image below.
This photo produces the more typical histogram below, screen-captured from Photoshop:
You can see that this looks very different than the simplified bar graphs we saw above. But this Photoshop version can be read just like the ones before. Specifically, the histogram shows the distribution of luminosity and moves from darker to light, black to white, as you move from left to right on the graph.
By the way, you may have noticed that all of our histogram examples so far are in reference to grayscale images. But all of this theory applies to colored images as well. You see, every color has a tone—an equivalent grayscale value— just like white and black and mid-grey. All colors have a corresponding shade of gray. Lighter colors correspond to a light shade of gray while dark colors have a grayscale equivalent that’s darker.
You can see this from the image below and it’s corresponding histogram:
Here the darker colors in the image—the dark pinks—are represented by the left-most areas of the histogram while the lighter colors—the yellows and lighter pinks—can be seen in the in the areas right-of-center on the histogram.
Okay, so now that you know what a histogram is, it’s time to look at using this tool to help you create better images. And that’s exactly what we’ll do in our next post…!