It seems that many may not realize that our photo histogram shows data with gamma-encoded numbers. It does though, and the numbers in the histogram may not be what we may imagine them to be, for two reasons, the data is in fact gamma-encoded, and in some cases, not using the proper RGB Histogram in the camera. Frankly, the article some of us possibly may need to read is Surprises in the Use of Histogram. This page is about gamma in histograms, and page two is about "What and Why is gamma?" (and a gamma calculator).
A histogram is a simple bar chart showing the count of the image pixels having each data tone 0 to 255. The height of each bar shown represents how many pixels have tonal value of 0 (black), and how many pixels have values of 1, and 2 and 3, ... all the way to how many, if any, pixels have tonal value of 255 (white). The histogram simply shows the distribution of the pixel tones, over the tonal range.
These absolute counts are not important, instead graph height is relative, because the histogram is scaled so that the tallest peak always reaches the top of the chart (which helps the lowest counts along base line to be more visible). The histogram is NOT about the absolute count or height, but is instead about the extent and distribution over the tonal range. Also, the histogram will always be 256 pixels wide, because it shows the pixel counts for the 256 tonal values.
More exposure will shift the graph data right, and less exposure shifts data left (because relatively more pixels will have brighter or darker data). With enough exposure, we can make black appear white, or vice versa, but the correct exposure is important to put the tones where they ought to be, which makes them be the tones they should be.
Normally, the main histogram detail that we are very concerned about is to warn if we are clipping at 255 (overexposure). Shifting data right (more exposure) cannot exceed 255, so the data piles up tall there at 255, called clipping. We can see and recognize that tall spike at the 255 end. Clipping is unrecoverable loss of detail, and should be avoided (if many tones are all 255, there is no distinguishable difference in them). However, seeing clipping requires using the three RGB histograms, because the histogram page shows that the single gray histogram (luminosity) CANNOT show clipping (or any real data). The three channel RGB histograms can and do show it.
A histogram is NOT a light meter. The camera has no clue what the scene is, or how the result "ought to be". The human photographer probably has a good idea, but the camera has no brain able to use any experience. The data curve is what is is (simply what the scene data is), but the histogram can show "what we do have", and can help show relationships, for us to decide.
What should the histogram look like? Generally unanswerable, but regarding the shape of the curve, that depends on the scene in front of our camera. If it is a correctly exposed black cat in a coal mine (a black picture), most pixels will be near the left end. If a correctly exposed polar bear in the sun on the snow (a white picture), most pixels will be near the right end. These are both correct desirable results which show the scene correctly.
However, unless we compensate to correct it, the reflective meter in the camera will try to put both of these cases somewhere around the middle (overexposing the black scene, or underexposing the white scene), as shown at How Light Meters Work. A light colored scene (a brides white dress) will meter high, and will be adjusted lower to middle (underexposure). The grooms black tuxedo will meter low, and will be adjusted higher to middle (overexposure). Learning to deal with the meter is part of what photography is. And that numeric value will also have gamma correction added, for example, the value represented by an 18% gray card should reasonably be 18% to the power of 1/gamma (to maybe 46%, more below).
But exposure also shifts the tones. Most "average" or "typical" general scenes will usually meter about accurately enough, because their subject includes a wide range of stuff that covers most of the full range - with their brightest colors reaching towards the right end of the histogram. The typical general scene really does often average out near middle gray, and regardless, the reflective meter tries to put all scenes at middle gray. And this often works out about right (mostly, but many exceptions). That is simply how reflective light meters work. But many scenes are exceptions too, which we need to watch for.
Again, the main important thing the RGB histogram data shows us, and the reason why we watch it, is if we see a thin spike right on the right edge (too many pixels of value 255), then we overexposed, and are seeing clipping our tones. Clipping means that brighter tones cannot exceed 255, and so are clipped to remain at 255 (and we lose ability to distinguish tones there, in pixel values of 255) Again, seeing clipping requires using the three RGB histograms (NOT the single gray one). Generally, vaguely speaking of average scenes and assuming many mixed colors and some brighter tones, we do like an exposure so the data does approach the right end, not quite touching it, but fairly high. Which is not absolute, it depends on the scenes colors. It merely assumes our wide-range image actually contains some tones which ought be up high - which is not always correct. We must use our heads too, and the appearance of the image preview on the camera rear LCD is probably better to judge this, appearance being what counts.
Regarding the specific numbers, we need to understand that histograms show the gamma data values.
Gamma is very mysterious, and invisible to us. We are told that it is in there somewhere, it just happens somehow, but we can never detect any evidence of it (except our histogram data does show its values). We do know our digital images use profiles like sRGB, which we know specify gamma 2.2. Unfortunately, what no one ever seems to realize is that this obviously specifies that our digital picture data is gamma-encoded. Unequivocally, all of the digital pictures in the world are gamma-encoded. It needs to be overtly said that all of our histograms specifically show this gamma-encoded data. We seem to ignore that. The technical stuff assumes it of course, but it never seems mentioned in any basics. The basics presented to laymen seem to just blunder around it, avoiding the subject, and which is no explanation at all, misleading at best. More next page.
Many seem to imagine that 128 is midpoint of their histograms, and that 18% gray cards are middle gray, and the gray card ought to show up at midpoint of their histogram too. We are led to believe this by much of the literature being too simplified. But in the histogram, there is more to it, so that is not exactly the right idea. Specifically, the histogram shows gamma-encoded data, and the numbers in the histogram are different than "popular theory" leads us to believe - which I hope to make obvious.
That is true by definition of course, but if you want to see proof that your histogram is in fact gamma encoded, then with your camera, shoot a white subject, exposure carefully adjusted so the histogram data edge lines up very near the 255 right edge (but without significant clipping). Then intentionally underexpose the second picture by exactly one stop. We know that one stop is half of the light, and we might imagine that the histogram right edge will move down to 255/2 = 128. And it would, in a linear histogram at the Raw sensor, just like we have always been told. However, we cannot see Raw data (no tools to view it). Anything we can see on a monitor is RGB data, and anything we can see in the histogram is the gamma-encoded RGB data.
Speaking of Raw images, they are of course affected by camera exposure settings, but raw file data is Not affected by those actual camera tonal adjustments mentioned just above (nor does raw have gamma yet either). But we don't/can't see raw data or raw images (Raw data is NOT RGB format, so we cannot show it). So raw files also embed a JPG image which is the preview shown on the camera rear LCD, and which is the source of the histogram that we see, which that embedded JPG DOES correspond to the current camera settings and gamma. But the camera tonal settings do Not affect the raw data, and this JPG histogram might not necessarily match the way you adjust the raw image later. Shooting Raw is of course desirable (offers a lot), but it IS more a philosophy and not just a setting.
128 may be the linear midpoint of 0..255 Raw data, but the RGB data we see is gamma-encoded, which shifts the linear 128 up to about 187 (73%, or about 3/4 scale) on the gamma-encoded histogram that we see. It won't be exactly 73%, because the camera is busy also doing White Balance and other of your adjustments. But one stop won't be 50%, instead more in the ballpark of 3/4 scale. The gamma calculator on next page will do this too. So in that gamma-encoded histogram we see, it is a mistake to call 128 the midpoint. This concept is sort of big, and it obviously exists, just look. It doesn't actually affect our pictures, because it will be decoded back to linear before our eyes see it - but it obviously affects the numbers in "storage", in the encoded histogram data.
18% gray cards seem a common confusion relating to gamma. It was known (halftone printing, 1880s) that the eye and brain perceives 18% reflectance as about middle gray. The first 18% gray cards were to help printers regulate their ink flow. Then later, film became popular, and then light meters, and today, the cards do still have exposure uses with our meters. But histograms are a digital concept.
Yes, Ansel Adams did popularize the 18% gray card as being middle gray at his Zone V back in the 1930s. The card was available then, and it was B&W then, and he was not using digital, histograms, or gamma-encoded data. His "middle" was whatever the card was (he understood it was 18%, and was only 50% in his mind's eye). My guess is that he had likely never seen a histogram back then. His reference was how the analog tones printed on paper.
The funny thing is that today some people recalibrate their light meter to make a gray card come out at histogram 128 (calling it "midpoint"). They heard 18% reflectance appears as middle gray, and they heard 128 was the midpoint of the histogram, so naturally, middle must mean middle. They assume there is some magic so that the gray card ought come out at middle.
However, it doesn't, 18% is not the middle of anything digital. 18% is simply not 50%. 18% is 18% in (linear) digital. Hopefully, we reproduce it as still 18%, so the eye will see 18%, and will think it looks middle gray. We do assume proper exposure will make 18% reflectance come out as value 46 (18% of 255, linear, assuming grayscale instead of color.) However, when this data becomes gamma encoded in our histogram, gamma 2.2 makes 46 be value 117, or about 46% (gamma 2.5 could reach 128, or if it were a 21.8% card, gamma 2.2 would compute at 128. Except that now, this midpoint in gamma 2.2 is near 187, about 3/4 scale.)
So anyway, they shoot the card in a picture, and then examine the histogram result, and gamma at 46% does make it coincidentally close to 50% (0.29 stop difference), and they say "Oh yeah, I've heard about that, and it probably ought to be middle".
Another problem of course, if directly metering a card with a reflected meter, it does not matter if they meter a 18% card, or a white card, or a black card... the reflected meter adjusts exposure to try to make them all come out about the same, near middle (an example is shown at what reflected meters do, and it is the reason for incident meters, which don't). The exposures of each card will vary to do that, but the histogram result, not so much. All three cards should come out middle gray, but that calibrated reference is what the camera meter does, not what the card is.
Still, the right idea of metering on the 18% card is that to us, it actually is "middle gray", and a reflected meter can directly meter the 18% gray card to simulate the exposure of an "average" subject. Some scene colors will be brighter, and some colors will be darker, but this middle gray should be about in the middle (maximum possible range up and down from it). Real subjects often contain a wide variation of many reflecting colors (sky, trees, snow, beaches, people, red McDonalds signs, white, black, light, dark colors), which average out to some tone value which the meter reads. The scene may not always cause a middle value, but the meter will set exposure to put it in the middle, whatever that means (probably it means 12.5%, but there are other digital influences, like White Balance or Vivid). But with reflected meters, predominately white scenes will be underexposed, and predominately black scenes will be over exposed. It's just how reflective meters work. Scene colors affect the reflective metering. White reflects well and reads high. Black doesn't reflect much, and reads low. The meter adjusts exposure to put both in the middle.
So specifically, the purpose of metering on the 18% card is: 1) it is seen as middle gray in grayscale, so hoping for a correct average exposure suitable for the range of most scenes, and 2) to give an actual reading of the LIGHT which is INDEPENDENT of the subjects actual colors which could meter wrong. The 18% card is assumed to give near correct exposure in this light for an "average" or "typical" subject, whatever that is, so we hope this middle 18% exposure is often about right for the actual scene in front of us. And it normally is pretty close, is actually more like using an incident meter, metering the light directly, independent of the subjects reflection. I am certainly NOT knocking the gray card method (but an incident meter would be easier). I do question the wisdom of trying to calibrate our meters with the card.
However reflected light meters actually use 12.5%, at least Sekonic, Nikon and Canon do. And except that Kodak always said to open 1/2 stop more if metering on their 18% card, which agrees with the meters. However, there is confusion now... Kodak sold this card printing business over 20 years ago (and it has been sold again since). We can still buy new cards showing Kodaks name, but sadly, the 1/2 stop is no longer mentioned. And the difference of gamma 117 to 128 is 0.29 stop, which used to round to this 1/2 stop, but we can use 1/3 stops today.
Coincidentally, this "midpoint" calibration misunderstanding (due to gammas help) causes only this small error, maybe not really the worst thing as a rough guide (which is all reflective metering is). Certainly it can be compensated, but certainly it is pointless, and plainly is the wrong idea. It is only coincidentally close to "middle" because of gamma, not because of exposure. 18% is not the midpoint of anything digital, and actual midpoint in gamma data is up near 187 at 73% anyway, at about 3/4 scale. And it varies with different color shifting manipulations in digital cameras, for example White Balance or Vivid.
Gamma is usually a constant 2.2, but even if you hear pros promoting it, calibration of the meter is certainly NOT about photographing the card one time. Not a great theory. Read Sekonic's calibration procedure, which does not mention gray cards. They know a thing or two, and according to Sekonic (and the ISO organization), the right idea to calibrate your meter is that IF it repeatedly and continually gives a consistent error on a wide range of scenes, THEN adjust the meter to compensate. Any one single reading is suspect anyway, too many variables.
The value used by most reflected light meters today (at least Sekonic, Nikon, Canon) is 12.5% (close to Kodak's half stop under 18%). Reflected K = 12.5 is shown in every Sekonic specification. That same Wikipedia article says Minolta, Kenko and Pentax meters used 14%.
There is an article on next page about What and Why is Gamma, and how does it work? (and a gamma calculator).