8
\$\begingroup\$

I understand the concept of histograms. I understand that the x-axis represents the luminosity range from min to max for either all channels or RGB individually, and I understand that the y-axis represents the occurrence of the value in the image, but what exactly is the scale of the y-axis? Obviously the maximum value doesn't represent the maximum number of pixels, so what does it represent? Often spikes appear to clip at the upper edge of the histogram.

\$\endgroup\$

2 Answers 2

10
\$\begingroup\$

The scale is somewhat arbitrary, and it is adaptive. That is, it's automatically scaled in an attempt to remain as useful as possible, given the image and its current adjustments. If you create an image in Photoshop that has a perfectly even distribution of colour or grey tones (let's say a 256-pixel image with one pixel each of every shade of grey from 0,0,0 to 255,255,255), you'll get a block histogram with every tone "maxed out". Edit a few pixels, and the whole histogram drops to show you the variation in distribution.

Ultimately, you are interested in "none", "some" and "many", and beyond that you don't care at all. Clipping in the vertical scale just means "lots of pixels are at this value", and if it happens anywhere other than at/near black and white, it's essentially meaningless to you. If you photograph a subject in front of an evenly-lit mid-grey background, expect a whole big bunch of mid-grey pixels; it matters not a whit whether there are 8 million or 9 million of them unless and until things that aren't supposed to look like a mid-grey background are indistinguishable from the mid-grey background when you look at the image. You're probably much more interested in the pixels that aren't the dominant tone, and if the display is scaled to fit the dominant tone, you might not see them.

\$\endgroup\$
7
\$\begingroup\$

You will always have one value touch the top of the graph because the scale is set to match the max Y value. It's not important what that Y value is, only it's relative proportion to the other Y values (hence, no numbers, ever). Below is an image that is 50% black and 50% white and you can see the graph is peaked on both sides. You can't see it in the screenshot, but the "count" is 12622500 for the 255 level (pure white). enter image description here

And this is an image of a gradient (imperfect, however) that shows the same size image and it's respective histogram. And for this graph pure white isn't actually the highest, level 254 ranks in at 189368. enter image description here

\$\endgroup\$
5
  • \$\begingroup\$ Thanks for the explanation. So you're saying the y-axis is adaptive, with the top of the graph representing the most-occurring value. So if the value 123 occurred 1590 times and 1590 was the most times that any one value appeared, then the top y-axis would have a range of 1590 and all other values would hold a value on the y-axis in proportion to this value? \$\endgroup\$ Jan 12, 2015 at 22:34
  • \$\begingroup\$ @Pedr pretty much it. It's more useful to know if the distribution of pixels leans brighter/darker/etc than to know exactly how many pixels are bright/dark/etc. Therefore the scale is not important, only how much higher/lower one part of the graph is compared to the others. \$\endgroup\$
    – tenmiles
    Jan 12, 2015 at 22:39
  • \$\begingroup\$ Thanks. Out of interest, is the curve in your second image indicative of the rolloff of the gradient itself or of the way the histogram interprets a linear (even) gradient? \$\endgroup\$ Jan 12, 2015 at 23:29
  • \$\begingroup\$ @pedr I think it has to do with the gradient. The graph goes from 0-255 and I suspect that the gradient isn't as linear because it may not be that aesthetically pleasing or near the ends it takes more solid to give the pure black or pure white appearance. \$\endgroup\$
    – tenmiles
    Jan 12, 2015 at 23:34
  • 1
    \$\begingroup\$ Sorry, this is incorrect. The top of the graph does not necessarily match the max Y value. It is relatively easy to get histograms where a number of values are clipped. \$\endgroup\$ Jul 24, 2016 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.