2009-02-18

Understanding Photoshop Histograms

I've been working on a new page for BWD called "Understanding Histograms". I've decided to publish it here first to get some feedback before publishing it to my main site.

Histogram is the technical term for what some people call a "bar chart". Here is an example of a histogram:



Histograms allow you to see complex data quickly. In photo editing software, the histogram shows you the number of pixels for each brightness level. The best way to understand histograms is to use a very simple example. Here is an enlarged view of a 50x50 pixel image:



This image uses only 10 shades of gray, here numbered 0 to 9:



To create a histogram, we must first count the number of pixels for each shade of gray.



















































Shade of Gray Number of Pixels
0
47
1
10
2
15
3
44
4
291
5
667
6
911
7
249
8
264
9
2
Total
2500

With this information we can construct the histogram.


Each vertical bar represents the number of pixels for that shade of gray. More pixels it has, the longer the bar. The shape of the histogram is called the distribution. This distribution shows that the image is heavy on the mid-tones (levels 5 & 6) and skewed to the right.

Of course, real black and white photos have many more shades of gray (256 shades of gray, numbered 0 to 255) and many millions of pixels. Here's the original high resolution photo and it's histogram:




Photoshop displays the histogram like this.



The histogram's range is from 0 to 255. The histogram panel shows additional information such as the mean, median and standard deviation of the histogram. However, what's important is the histogram's distribution. There are four things to look for when reading the histogram: minimum, maximum, skew, and spread.

Minimum

What is the histogram's minimum value? A histogram with lots of pixels in the 0-5 range may mean that some parts of the image may be blocked. Blocking is when parts of the image becomes so dark that detail is lost. You want to avoid blocking. Even the darkest parts of the image should have some detail. You should be able to "see into" the shadows. Of course, there may be times when you want to deliberately block parts of the image for artistic reasons.

Maximum

What is the histogram's maximum value? A histogram with lots of pixels in the 250-255 range may mean some parts of the image may be blown out. Blowout is when parts of the image becomes so bright that detail is lost. You want your histogram to fall within the 5-250 range. This will avoid blocking and blowouts. Again, there may be times when you want to deliberately blow out parts of the image.

Skew

Is the histogram leaning to the left or to the right of center? An image that is too dark will have the histogram heavily skewed to the left. One that's too bright will be skewed to the right.

Spread

Is the histogram piled up into a single peak, or is it spread out? A low contrast image will have a pyramid shaped histogram. A high contrast image will have a flat or even a twin peak histogram.



Lets analyse the swan photo using these four criteria.The minimum value is around 4 and there no pixels piled up around 0. This means there are no blocked shadows, which is good. The maximum value is well below 255, so there are now blown highlights. This is also good. The histogram is skewed slightly to the right of midpoint. This means that the photo is on the bright side but not overly so. There's no need to correct the brightness. Finally, the bulk of the histogram is a huge pyramid in the middle with two smaller peaks on either side. The small peak on the left represents the dark patches on the swan's face. The tall peak on the right represents the bright patch on the swan's back. Although there are dark and bright patches, this is actually a very low contrast image.

No comments: