Your Histogram Questions Answered :: Digital Photo Secrets

Your Histogram Questions Answered

by David Peterson 6 comments

Ever since writing the article on your camera’s histogram, I’ve been getting all kinds of questions about them. It seems that I haven’t explained enough, and that’s understandable. Quite a lot goes into a histogram, and I wanted to give you a quick and simple explanation of what they do. Now it’s time to go more in-depth and explain the histogram with much more detail.



What does the y-axis on a histogram represent?

Most of the questions asked are related to the y-axis, so let's talk about that first. Frankly, there are only a few people who know the actual answer. But before we look at the y-axis, let’s make sure you’re up to speed on the x-axis and what it represents.

As I said in the previous article, the histogram gives you a quick snapshot of the percentage of different tones that are present in your image. The x-axis in a histogram begins with the darker tones on the left and then progresses to the brighter tones on the right. Each little “tick mark,” or location, on the axis represents a single tonal value (or brightness) with the darkest tone on the left and the brightest tone on the right.

I get the feeling that most of you understood this from the previous article. You know that an underexposed photo, for example, is more shifted to the left. That’s because more of the pixels in an underexposed photo occupy the darker x-axis regions.

So, given that we know this, does the y-axis represent a certain number of pixels at one particular tonal/brightness level? Sort of... but not exactly. If there are more pixels with a particular brightness value, they will show up as a spike on the y-axis, but the math behind it is a little more complicated than that.

Sometimes the best way to explain something is to talk about the extremes, what I like to call the “boundary conditions.” Let’s put on our thinking caps and imagine some situations that will never happen the real world but will definitely demonstrate some of the math behind the histogram’s y-axis.

What would happen if you were to capture every tonal value in the exact same amount?

What would your histogram look like? Well, it would look like a flat plateau of the exact same height, running from the left to the right, but it wouldn’t be very tall. Why? Because the y-axis represents a percentage of the total pixels at one particular tonal/brightness value.

There are 256 different tonal values in a histogram. If your photo were perfectly evenly exposed, each y-axis value would be equal to 1/256. That’s not much, but you’ll still see the y-values because your histogram zooms to fit, cutting off big y-values at the top. Why does it do this? Because if it didn’t, most histograms would be unreadable. Everything would look very small, and you wouldn’t be able to tell what’s going on with your photo.

What would happen if you were to capture a single tonal value and no others?

First of all, you simply can’t do this in the real world. There is too much variation in brightness/darkness for it to be possible. But we’re being imaginative here, so let’s assume we can. What would it look like?

It would be a single column at any one x-axis location, and the rest of the histogram would be completely clear. To put this into nerdy math language, one x-axis value has a y-axis value equal to 1 (also 256/256), and all other x-axis values have y-axis values equal to zero (0/256).

In all likelihood, a histogram like this would be clipped at the top. Whenever you get “too much” of one particular tonal value in your image, the histogram tends to show it as a cut off spike with similar values nearby. I think the histogram program zooms to fit up to a certain window width and height. Beyond that, it starts cutting off y-values.

So after all that explanation, the y-axis represents the percentage of pixels that occupy a certain tonal or brightness/darkness value.

Does the surface under the curve represent the total pixels in the image?

Who would ever have thought we’d start talking calculus? Aren’t we supposed to be artists over here? To answer this question, we simply need to refer back to our understand of the histogram’s y-axis. If each y-value represents a percentage of the image at each tonal value, what would happen if were to add them all up?

In short, we’d get 100%. So yes, the surface under the curve represents the total pixels in the image. Just so everyone is on the same page, you can get the surface under a curve by adding up all of the y-values at each x-location. The mathematical term for it is “integration,” but it’s basically the same thing you would do to determine the area of a rectangle - assuming you know its width and height.

Why does it sometimes look like the surface is smaller in some histograms than in others?

Because your camera’s histogram zooms to fit a reasonable portion of the histogram into the frame. If one histogram has a really big spike at one of the tonal values, your camera attempts to fit as much of the spike into the frame as it can without making the other tonal values nearly invisible. You get a quick and dirty snapshot of your tones at the cost of perfect pixel-for-pixel accuracy.

Whenever “clipping” of this sort occurs, it’s because you have way too much of one particular tone. Since everything is done in percentages, you necessarily don’t have as much of the other tones. Whenever a portion of the histogram gets cut off at the top, you’ll see a decrease in the total surface area displayed on the screen.

Can anyone just show me a histogram with some numbers or a scale of some kind?

Of course we can, but be aware that your camera will never do the same. Your histogram should start with a percentage of zero at the bottom and 100% at the top (on the y-axis). Just remember that it’s rare for any one tonal value to take up 100% of the pixels, so there’s always going to be some clipping at the top.

But, honestly, you don't need to see the percentages or raw numbers on the y scale to see if your image is properly balanced (the whole purpose of histograms). Just make sure that there aren't too many spikes, or low areas, and make sure the graph isn't too one-sided (like the one at the top of this article which is very lop-sided to the left and right).

Is the y-axis linear or logarithmic?

This one’s for all you math nerds out there. Because the y-axis represents a percentage of the total pixels, it’s linear. Any increase in a y-value is a linear increase in percentage. Of course, it might not always look linear. Once again, that’s because your camera zooms to fit a reasonable portion of the histogram into the frame. When it cuts off some of the y-axis, you might be led to think that the y-values increase on a completely different scale. They don’t.

Is the vertical axis autoscaling to the level with the highest amount of pixels?

To the extent that it doesn’t make the rest of the histogram unreadable, it is. Let’s go back to our “big spike” example. If the histogram were to autoscale to fit the entire spike, you wouldn’t be able to see any of the other values. You always want to have some understanding of what’s going on with your other tones, even if you don’t have many of them. That’s why your camera is willing to clip the spike to show you these values.

It seems that everything centers around the mystical y-axis and what it represents. Hopefully this explanation has brought more clarity to the discussion so you know exactly what you’re looking at when you pick up your camera. If you have any more questions about histograms, go ahead and post them in the comments. I’d love to answer them for you.

Most people think this post is Awesome. What do you think?

Comments

  1. kumbidi says:

    Thanks a lot sirr.. great article.. :)

  2. Javier says:

    Thank you so much. This exactly the kind of explanation of the histogram y-axis I was looking for. I'm surprised that so many books on photography do not explain this properly!
    Again, thanks a lot!

  3. MIKE says:

    HI DAVE
    SINCE GETTING TIPS FROM DAY 1, I BELIEVE I UNDERSTAND MY CAM AND SETTINGS MORE THEN BEFORE . THE BONUS TIPS ARE GREAT & I AM ABLE TO EXPERIMENT AND ENJOY
    STILL NOT @ YR LEVEL ....BUT

    THOSE I HAVE PUT ONTO YR SIGHT HAV NOT STOPPED THANKING ME
    THANX BOET
    MIKE H

  4. Gtg says:

    Grate article, a lot of help Tk David. I used the histogram all time is mine North in tonal value.

  5. Charlie says:

    Hi David - great article, I can appreciate the challenges of making digital camera histograms understandable to an audience of wide ranging backgrounds and areas of expertise. I wanted to comment on one item:

    You can approximate capturing capture a single tonal value and no others: shoot with the lens cap on (you'll get a vertical spike at the left edge of the x-axis, similarly, similarly, if you leave your shutter open long enough, you can shoot in a dimly lit room and completely overexpose, thus getting a vertical spike at the right edge of the x-axis. Fill your frame with and shoot an 18% gray card at camera indicated correct exposure and you'll get something of a narrow-distribution/spike near the center of the x-axis.

    I use these techniques to help explain the histogram to folks who are new to or struggling with the histogram. It's also fun to see the looks on their face when you shoot a full frame of black poster board and render it as gray or white as a result of lengthened exposures, same thing with shooting a white poster board and rendering it gray or black as a result of shortened exposures.

    Thanks again for a great article!

  6. Roy says:

    A great help with thanks- Roy

Leave a Comment

Your email address will not be published. Required fields are marked *

Difficulty:
Advanced
Length:
11 minutes
About David Peterson
David Peterson is the creator of Digital Photo Secrets, and the Photography Dash and loves teaching photography to fellow photographers all around the world. You can follow him on Twitter at @dphotosecrets or on Google+.