home. photography. artwork. research. me.
galleries. understanding histograms. photography articles.

Section 1: What are Histograms?

Let's start at the very beginning by asking "what is a histogram?" In the most basic sense, a histogram is simply a visual representation showing the results of counting a collection of things. As a concrete example of counting, let us count the letters in the word "Mississippi" to see how many of each letter there are. The letter counts are m:1, i:4, p:2, s:4, a:0, b:0, and so on. That's it! That is the information that a histogram represents.

Of course, there are several ways that we count the letters in the word "Mississippi." We could count the number of vowels vs the number of consonants. We could count the number of upper case letters and the number of lower case letters. There are lots of different ways we can count things. The real question is, how many useful ways are there for us to count things. Further, once we done the counting, how can we display this information in a clear and useful way.

Since this is a photography article, let's focus on the histograms that are displayed on your camera and the histograms that are presented by pieces of software like Adobe Photoshop. These histograms count the pixels in the particular image that you happen to be looking at, either in the camera or in the software. To make things easier to begin with, let's start this article by considering black and white images that only have gray values.

Those Pesky Pixels

To understand exactly what a histogram is telling you, one first needs to understand what pixels are. More to the point, one must understand what pixels contain. This is a straight forward and basic idea. A two dimensional (2D) image is basically a 2D grid of pixels. Each pixel in the grid of pixels (i.e. the image) contains a pixel value. The pixel value determines what the pixel looks like. In a greyscale image, this is how dark or bright the pixel is. In a color image, the pixel value is more complex and comprised of a mixture of a red value, a green value, and a blue value. In RGB-based color images, pixel values also sometimes contain an alpha value which relates to the opacity of the pixel. To make the explination of histograms easier, let's first just focus on black and white photographs (i.e. greyscales images). In a black and white photograph, the value of the pixel simply represents how much light there is in that pixel. A value of 0 (zero) represents no light at all and thus is displayed as black. The largest value a pixel can have is 255, and this value is displayed as white. In figure 1, we can see how pixel values relate to a greyscale.

A chart of grey values, in ten percent increments.

Figure 1: This chart shows the relationship between grey values (in 10% increments) and the pixel values used by a computer to store image data.

The Structure of a Histogram

Structure of a histogram for a black and white photograph.

Figure 2: Structure of a histogram for a
black and white photograph.

Speaking in the most general sense, a histogram is type of chart that divides a set of things into a set of bins and then displays how many things are in each of the bins. It is typically the case that the bins can be ordered somehow. We won't get into a general description of histograms. Just know that they are quite useful in a variety of situations where one wants to summarize a given set of data.

In the case of photographs, the things to be counted are pixel values, and each possible pixel value is given it's own bin. In essence, this is a way of counting how many pixels there are with a pixel value of 0, how many there are with pixel value of 1, and so on. The histograms for photographs, either on the back of your digital camera or in a peice of software running on your computer, display this counts as chart made up of vertical bars, with one bar for each possible pixel value. The bars are ordered, typically with the bar representing the lowest possible pixel value on the left and the hightest possible pixel value on the right. In the case of greyscale images, those are the pixel values 0 (black) and 255 (white), respectively. Refer to figure 2.

In figure two, for the sake of illustration, I have drawn the columns for each of the pixel values rather large (wide) so that it is easy to see how the histogram is structured. However, since there are 256 unique pixel values in black and white photographs (don't forget to count column zero), software will render 256 columns in the histogram for the photograph. As a result, the individual columns are usually quite thin so that all of them will fit in the histogram on the back of your camera or on your computer's display. See figure 3 for an example of what you would see in Adobe Photoshop. Adobe Photoshop is a well-known and very useful program for working with digital photographs. If you are unfamiliar with Adobe Photoshop, I suggest that you read up on it and give it a try. Figure 3 gives an example of a photograph and the associated histgram.

Example of a histogram for an actual black and white photograph.

Figure 3: Example of a histogram for an actual black and white photograph.

After just looking at the histogram in figure 3 for a moment, there are three important peices of information that we can see. We will discuss these ideas next.

Exposure and Histograms

The histogram of a photograph is directly related to the exposure of the photograph. Hopefully this idea should be fairly self-evident at this point.

A photographer taking this photograph can look at the histogram on the back of his or her camera and see that shape of the histogram. In the case of the photograph in figure 3, most of the pixels are either in the dark or middle regions. Relatively few pixels are in the bright region of the histogram. Knowing this information at the time I take the photograph will allow the photographer to adjust his or her exposure settings and take the photograph again with the adjusted settings before leaving the location. For this photograph, the photographer may wish to increase the amount of time the shutter is open, letting in more light and brightening the photograph.

This is particularly useful when a photographer is in a situation where the light around them will affect how bright or dim a photograph looks when reviewing it on the camera's LCD screen. For example, say it is a bright, sunny day and you are out photographing a landscape. It might be so sunny, that it is hard to see the LCD on your camera and thus hard to tell if a photograph is over or under exposed by simply looking at the photograph itself. Is the photograph actually too dark, or does it just look too dark because there is a lot of glare on the LCD screen? Well, you can know for sure by looking at the histogram. The opposite is also true in a dark situation. If you are in a very dark room, then the LCD will seem relatively bright compared to your suroundings. As a result, reviewing a photograph using your camera's LCD screen in dark surroundings may cause the photograph to look brighter than it actually is.

Do not make the mistake of thinking of the histogram as a tool that is tells you whether or not you have exposed a photograph correctly. After all, the term "correctly" as used in this context is a matter personal aesthetics. Rather, think of the histogram as a tool that tells you if you have the exposure that you want. Remember, the histogram gives photographers insight to how the light enterying the camera was captured by the camera's sensor. Did the sensor capture a lot of light? Did the sensor capture very little light? In some cases, it is expected that the pixels in a photograph will be heavily weighted towards the dark or bright regions of the histogram. For example, if one were taking photographs of fireworks the majority of pixels in the photograph will end up being black sky in the background. In this case, it is expected that the majority of the pixels will be somewhere in the the dark region of the histogram.


When a digital camera is used to take a photograph, the sensor converts the light that reaches it into an electrical signal. This is what people mean when they say the sensor measures the amount of light entering the camera. For any given pixel, the more light that reaches that portion of the sensor produces a stronger electrical signal and thus a higher pixel value. The opposite is also true. A lower level of light produces a weaker electrical signal and thus a lower pixel value. The range light amounts that any given sensor can detected is fixed. Therefore, the exposure settings on the camera are used to change the amount of light reaching sensor. In other words, the photographer adjusts the intensity of the light reaching the sensor so that the amount of light reaching the sensor falls within the range of values that the sensor can effectively detect. When too much light reaches the sensor, the electrical signal is maxed out and thus the pixel value is maxed out, or clipped to the pixel value 255. When too little light reaches the sensor, these dark signals are clipped to the minimum pixel value of 0.

This clipping effect can be seen in the histogram presented in figure 3. Notice that the column of the far right is higher than the column next to it. This jump in the number of pixels with a pixel value of 255 compared to the other bright pixel values is an indication that several pixels were clipped or maxed out at 255. Darkening the exposure would allow the pixels that were brighter than the sensor could handle to fall within the range of the sensor. However, the same is also true on the dark end of the histogram. The column on the far left is taller than the columns next to it. This is an indication that some pixels are actually darker than the sensor could detect, and thus were clipped to value of 0. If an area of the photograph was clipped to one side of the range or the other, this would mean that the detail in that area of the photograph would be lost. The pixels in that area all have the same pixel value and thus the area looks flat (i.e. an area of pure white or pure black).

The limited range of sensors and the clipping effects that this limited range produces has led photographers to use techniques that combine multiple exposures with different exposure levels so that all the detail in the scene is visible in a final composite photograph. One such technique is called high dynamic range (HDR) photography. A discussion of HDR goes beyond the bounds of this article, but one can tell of HDR techniques would be useful for photographing the full range of light values in a particular scene or on a particlar subject by looking at histograms.


Another thing to keep in mind when looking at the histogram of a photograph is the noise introduced by the camera's sensor. Like all electrical devices, digital sensors are affected by electrical noise. That is, when the sensor is taking a measurement of the light and creating an electrical signal to represent the amount of light it is detecting, electrical noise will have an effect on the quality of that signal. Things that increase the strength of that signal, such as increasing the ISO setting, will also increase the noise within the signal. Good sensors have lower signal-to-noise ratios (SNR), which means the signals are strong compared to the amount of noise within them, so amplifying the signal to boost brightness results in less noise being visible within the resulting photograph for the same amount of amplification.

If you would like to see the noise being produced by your camera's sensor, one way is to take a photograph while leaving the lens cap on the lens. In an ideal world, one would expect all of the pixel values to be equal to zero since there is no light reaching the sensor. However, if you try this, the pixels will not all be zero. The pixels will actually have a small amount of variation. As the shutter speed is made slower, the amount of noise will increase.

Two histograms shown side by side.  The right histogram is wider than the left histogram.

Figure 3: A narrow histogram versus a wider histogram.

If we want to minimize the amount of noise there is in a photograph, we can pay attention to how much of the histogram we are using (i.e. how much of the sensor's range we are taking advantage of). First, let's say the noise within a given sensor has the ability to change a pixel's value by as much as 3 (i.e. the amount of error in the sensor). Next, consider the two histograms presented in figure 3. The histogram on the left is narrower than the histogram on the right. These two histograms might be the result of photographing the same scene or subject with a darker exposure (left) and a brighter exposure (right). The range of pixel values in the left histogram is much lower than the range of pixel values in the right histogram. Therefore, changing a pixel value in the left histogram by 3 will have a relatively greater effect on how that pixel appears visually when compared to the other pixels in the same photograph. However, changing a pixel in the right histogram by 3 will have a smaller effect on how that pixel appears visually compared to the other pixels in the same photograph.

Keep in mind that this example is a bit artificial and just meant to illustrate the point. If your goal is to reduce the amount of noise in a photograph, then making use of the sensor's entire range (i.e. as much of the histogram as possible) will be advantageous because it keeps the signal-to-noise ratio (SNR) low.

Why do pixel values range from 0 to 255?

At this point, you may have already begun wondering why are pixel values range from 0 to 255. From the point of view of a photographer, this really doesn't make a whole lot of sense and probably feels a bit arbitrary. However, if you are familiar with how computers represent data, you may recognize this range as being the number of unique values that can be represented using a single byte of memory.

Computers, and digital equipment in general, use little switches called transistors that can either be on or off. Any peice of data that is contained within a computer must be encoded as a series of 1s (on) and 0s (off) so that the computer can process it, store it, or whatever else it needs to do with the data. Each one of these 1s and 0s is refered to as a bit. A collection of eight bits is called a byte. The reason for using eight bits rather than ten or any other number of bits is a matter of computing history (related to text files and ASCII charts). This is also why digital images are encoded using 8 bits (one byte per channel), 16 bits (two bytes per channel), or 32 bits (four bytes per channel). This is also why many computer screens are said to support 16 million colors. Each of the three color channels (red, green, and blue) can range from 0 to 255 (256 unique values), so that is 256 * 256 * 256 = 16,777,216 possible color combinations. If you are interested in that history, start with the Wikipedia article on "bytes".

next >>