How to Use Histograms to Take Better Pictures
What can a histogram tell you about a photo? How can it help you take better pictures? And how can it improve the pictures you’ve already taken?
Jason Marshall, PhD
Listen
How to Use Histograms to Take Better Pictures
Have you ever (most likely accidentally) pressed some sequence of buttons on your camera that caused a crazy-looking squiggly graph to appear on the screen? You’ll definitely know if you’ve seen this because it probably took you several minutes of additional button-pushing to make it go away. But, as we’ll soon see, you might want to figure out how to get it back on the screen and to have it ready when you need it.
Because, as it turns out, that graph—which is actually a histogram—is pretty useful (which I suppose is why the camera manufacturers put it in there in the first place). What does this photo histogram show you? Why might you want to look at it? How can it help you take better pictures and improve the pictures you’ve already taken? Let’s find out.
A Quick Recap of Histograms
As we learned last time, a histogram is a type of graph that allows you to see how the values of some data are distributed. In our example, we imagined measuring the widths of a bunch of leaves and then creating a histogram of them. To do so, we sorted the leaves into several bins based upon their sizes, and then we counted up how many leaves were in each bin. We chose to make our bins 1 cm wide, but we could have chosen 2 cm, 5 cm, or any other size we like. The number of leaves in our bins became the heights of the vertical bars of our histogram. And from this, we found that we could learn a lot about our leaves.
You just might want to make use of a histogram or two this holiday season when you’re taking pictures.
Of course, I don’t expect that many of you encountered a problem like this over the past week which required you to measure leaf widths and construct a histogram based upon them. But don’t let that fool you into thinking that histograms aren’t something with huge practical use. In fact, as we’re about to find out, you just might want to make use of a histogram or two this holiday season when you’re taking pictures.
What Does a Photo Histogram Show You?
Most digital cameras will happily show you a histogram of values for the image you’re about to take (you just have to figure out what button to push to see it). While the standard iPhone and Android camera apps might not have the ability to show you this histogram, there are plenty of third party camera apps for each platform that do just that.
But, you might be wondering, what are these values that photo histograms show us? To understand how photo histograms are made, we need to talk about how digital pictures are made. In particular, we need to talk about pixels. Every digital image you capture is really just a two-dimensional grid of numbers, each of which belongs to a single pixel in your image. And each of these pixels represents the brightness of a given spot in your image.
As we’ve talked about before, computers store numbers in binary format. It’s common for each pixel of an image to use 8 bits of memory (also known as 1 byte) to store its value. This means that each pixel can have one of 28 = 256 possible values ranging from 0 for the darkest regions up to 255 for the brightest. To create a photo histogram, all you do is treat each of these possible values as a bin, count up the number of pixels in each bin, then make the graph. Since that’s a lot of bins, you won’t usually see the individual bars in a photo histogram (even though they’re really there). Instead, you’ll typically see what looks like a spiky line that shows you how many pixels are dark (on the left), how many pixels are bright (on the right), and how many pixels have medium values (in the middle).
What Does a Photo Histogram Tell You?
So photo histograms show us what fraction of the pixels in an image are bright and what fraction are dark. But what can such a histogram tell us about the images we are about to take? In other words, how are they useful?
The simplest thing you can learn from a photo histogram is whether or not the image you’re about to take is well exposed. In the old days of film cameras, that literally meant whether or not the proper amount of light would fall on the film to make a proper exposure. These days we don’t have to worry about film, but we do need to make sure that each pixel collecting light for our digital image gets properly “exposed”—not too much light, and not too little.
The simplest thing you can learn from a photo histogram is whether or not the image you’re about to take is well exposed.
If you look at a photo histogram and see that almost all the pixels are dark (one big peak on the left side of the histogram), you might want to think about either manually increasing the exposure time (not always easy to do on a digital camera) or changing the lighting. Of course, if you’re taking a picture of stars or fireworks in the night sky, you’d expect a histogram like this since most of the pixels should be dark!
On the other hand, if your histogram has a peak on the right side, it’s possible that your image is overexposed. In this case, you might need to shorten the exposure time or reduce the amount of light on your subject.
In general, the photo histogram of a well exposed image will show a broad peak indicating a nice distribution of light and dark regions. But remember, this isn’t a hard and fast rule—sometimes the right histogram will be different depending on the situation and the particular desires of the photographer. But either way, a photo histogram can help you figure out whether or not the exposure is correct for the picture that you ultimately want to take.
Wrap Up
So that’s how to use your camera’s photo histogram feature and a bit of math know-how to take better pictures. But how can you use histograms to make the pictures you’ve already taken better? And why are there three lines on your camera’s histogram instead of one?
Unfortunately, we’re all out of time for today. So the answers to these questions and even more about the awesome relationship between math and photography will have to wait until next time.
In the meantime, for more fun with math, please check out my book, The Math Dude’s Quick and Dirty Guide to Algebra. Also, remember to become a fan of The Math Dude on Facebook and to follow me on Twitter.
Until next time, this is Jason Marshall with The Math Dude’s Quick and Dirty Tips to Make Math Easier. Thanks for reading, math fans!
Photo histogram image from Shutterstock.