Hi,
I can't better the advice Terry has given, so I won't try.
A bit of background may help understanding ...
A histogram is merely a graphical representation of the number of pixels at each and every luminance level.
So just think of it as a bar graph - the sort with vertical columns - unfortunately, it doesn't look much like a bar graph because all the individual columns (one for each luminance level) are pressed up against each other and they're all the same colour, but that's all it is.
The height of each column scaled in proportion to the maximum number of pixels (at the most prevalent level), the absolute numbers don't matter, so the vertical axis is not scaled numerically.
The horizontal axis is scaled; 0 on left (darkest digital value possible) and 255 on the right (brightest digital value possible).
I appreciate this may be a difficult concept to grasp mentally if you're not used to it - the tutorials here may help.
https://www.cambridgeincolour.com/tu...istograms1.htm
https://www.cambridgeincolour.com/tu...istograms2.htm
Or you could abstractedly think of it like this;
Imagine a black and white image made up from wooden blocks
Each pixel is a wooden block
Each different level of luminance is a subtly different shaded block, with white ones, black ones and 254 other shades of grey in between.
When you view the image, they are stacked as the camera took the image, in a rectangle, with the top left image element at the top left corner and so on.
Now knock 'em all down
Sort them into piles of the different shades (
good luck with that!)
Now
carefully stack all the black ones on the left (in one tall column)
Then add the next brighter shade of grey beside them (to right); in a new column just touching
Repeat 254 times - until you stack all the pure white blocks on the extreme right
Some columns will be tall, some less so
Now stand back - turn off the room lights - and switch on a light behind the stacks
There is your histogram - a real physical one
in silhouette
Anyway ...
When you capture an image of a typical scene, there usually will be some pixels at all levels between the brightest and darkest pixels in the image - unless shooting say; a very evenly lit chessboard
Under exposure will cause the brightest pixels to not reach level 255, this is shown by the flat area on the right hand side of the histogram.
Flare will cause the darkest pixel level to be somewhat above 0, as shown by the flat area on the left.
In other words; it is a low contrast image.
In my analogy above, this doesn't mean less blocks, just more of the same shades, with no white or black ones at all.
As Terry says, if this is not addressed while the image is being edited in 16 bit mode (e.g. RAW), when you stretch the contrast; to put the darkest pixels nearer (or on) 0 and the brightest nearer (or on) 255, it will simply drag the levels apart, leaving gaps. Meaning there are no pixels at certain luminance levels.
In my analogy above (but with a low contrast image), think of spreading the columns apart so the ones that should have been white are in the place they should be (extreme right) and the ones that should have been black are fully over to the left. Now spread the others out, but remember you cannot have them at half levels, they must be in one of the 256 possible places, which leaves gaps
So imagine the original image, which has some pixels at level 127 and some at 128, since the two columns nestle against each other there is no gap.
If the contrast stretch is completed and/or displayed on an 8 bit histogram, it is possible that the pixels that were 127 are shifted to 126, while those at 128 stay put, the revised histogram now shows a gap one pixel wide at level 127. Sometimes the gap can be wider, you'll see there are some of these in the example provided, over to the right.
You will also note that some subsequent image editing operations will remove the gaps - anything that interpolates pixel values to achieve an effect; e.g. sharpening, image rotation, etc., will make the histogram gaps reduce or disappear. Please note however that it may not remove/reduce any visible problematic banded/posterized area in an image, because the interpolated pixel levels can be anywhere in the image and hardly be noticeable.
HTH, Dave