No purchases yet.
Your cart is empty 0 items $0.00 Go to Checkout 0 Login

Histograms – From your camera to Photoshop

Rating: 0 based on 0 Ratings
Leonardo Regoli
  By Leonardo Regoli
Histograms – From your camera to Photoshop www.sleeklens.com

In this post I want to take a detailed look at one of the most basic tools used in image processing and that is sometimes overlooked by photographers. I am talking about histograms, an incredible useful way of looking at the data contained in an image that can give a lot of information both during the capture of an image with your camera and during the post-processing using an image processing software such as Photoshop.

What Is a Histogram in Photography?

But let’s first take a look at what a histogram is. A histogram is a graphical representation of any type of information, it does not have to be an image. In formal terms, a histogram is a bar plot that represents the number of occurrences (y-axis) of a given event (x-axis). This could be, for instance, the number of people with a given age within a group. Imagine, for instance, a photography club where the members have different ages as follows:

  • 20 years old: 3 members
  • 21 years old: 1 member
  • 22 years old: 1 member
  • 23 years old: 4 members
  • 24 years old: 1 member
  • 25 years old: 6 members
  • 26 years old: 0 members
  • 27 years old: 2 members

A histogram representing the values above would look like the following figure.

You can see the age range represented on the x-axis and the number of members with a given age on the y-axis. This way of presenting the information is very simple and easy to interpret and hence the widespread use of histograms in all branches of data analysis.

When talking about photography, the x-axis will represent the intensity or brightness (which can go from 0 to 255 on an 8-bit image) and the y-axis will represent the number of pixels with that given brightness. In the case of a grayscale image, a single histogram contains all the information of the image while in the case of a color image three separate histograms are needed, one for each of the basic colors.

Notice that given an image, a histogram can be constructed, but given a histogram, an image cannot be constructed. In other words, when a histogram is created, important information is lost and thus histograms cannot be used as compressing algorithms. This is because the histogram tells us how many pixels have a given brightness level, but it does not give any information on the location of those pixels within the image.

So what information can we get from a histogram? This is related to a rule of thumb according to which the more spread among all values a histogram is (i.e. flat) the more balanced the image will be. Now, when applying this rule, you need to take into account what type of image you are dealing with.

Take, for instance, the following black and white image of the Charles Bridge in Prague together with the histogram (highlighted with a red rectangle) as shown in Photoshop.

There are a couple of things that we can learn from this image. First of all, the scene looks rather dark, and that is why almost all the pixels are on the lower (leftmost) half of the histogram. The histogram is ordered from left to right, with the darkest value (0) on the left and the brightest one (255 when working with an 8-bit image) on the right.

In addition to this overall distribution of the brightness values, it is also noticeable that there are two main peaks with a valley in between. In this particular image, the reason for these two peaks is that both the water and the bridge itself are rather dark while the rest of the buildings and the overcast sky are lighter. This means that the scene itself lacks of mid tones and hence the gap in the histogram.

If we improve the image by increasing the brightness and the contrast, we end up with a much flatter histogram that also covers a wider range of brightness values.

Now you can see how the center of the bulk of pixels moved to the right and it lies much closer to the center of the histogram. At the same time (and as a consequence of this), the image looks much more balanced than before.

If you look closely to the histogram, especially on darkest pixels, you can see that the bars are now much more disperse than before with a lot of variations and low values intertwined with high values. This is actually a consequence of the algorithm used to increase the contrast in Photoshop, which is similar to a histogram equalization.

Now, what happens if your image was intended to be dark? Good photos are not necessarily those that comply with all the rules known like for instance a flat histogram, completely in-focus or well balanced in colors. After all, that is why automatic modes do not always produce the images we are looking for.

The image below, once again from Prague, is a backlit scene that was intended to be dark in order to create a high contrast photo as a result.

Notice how the histogram shows most of the pixels on the left side with a relatively high peak on the far right side. This is the result of having the Sun on the image which, even though small, is very bright while the rest of the scene is underexposed to capture the silhouettes and shadows. Trying to get a flatter histogram with this image would render a completely different (and unwanted) result.

Finally, the image below, from the Red Square in Moscow, is a much more balanced one, something the is reflected on a histogram centered at the mid tones. Even though there is a high concentration of pixels on the middle, the overall distribution is symmetric and has a good coverage of all the values without getting into the extremes (under or overexposed areas). This is also a natural consequence of the scene being captured, with no strong shadows or light sources included.

Notice that even though this is a color image, the histogram I am showing is the luminosity one. This is because what we are interested on here is the exposure balance of the picture, so the full color histogram will not yield any useful information for our purposes.

As you can see, in general, the use of a histogram can be very useful, but you need to get used to the particularities of each image in order to correctly read it. When capturing an image, it is useful to look at the histogram for a couple of reasons. First, the back screen of your camera can be brighter or darker than the average monitor. This means that you could get disappointed when you get back home and open your images with your computer. Also, if the ambient light is too strong, the contrast of the camera screen might no be good enough to distinguish whether your image is properly exposed or not. However, a histogram will always be visible and, as long as you stay away from the extremes (unless that’s your intention!), once you get back home you will at least be able to do a good job with post-processing, since your image will not have completely dark or burnt out areas.

Something similar goes with post-processing. No matter how bright or dark your monitor is, looking at the histogram will always give you an objective assessment of the exposure of your final image. This way you will avoid the problem of publishing a photo that looks too dark or too bright in other people’s monitors.

I hope this post was useful to you. Next time you are out making photos, look at the histograms of the photos that you take and I am sure that with some time you will incorporate this great tool in your workflow. And as usual, if you have any question, just write me an email!

Rating: 0 based on 0 Ratings
The following two tabs change content below.
Leonardo Regoli
Leonardo Regoli is a self-taught amateur photographer currently based in Ann Harbor, Michigan (USA). His main interests are travel and landscape photography.

Comments (0)

There are no comments yet.

Sign me up for a weekly summary of the best articles published on the blog

Your email is safe with us. Pinky swear