A PRACTICAL GUIDE TO INTERPRETING RGB HISTOGRAMS

Learn how to interpret your digital camera's thumbnail image histogram to help determine proper in camera exposure
Learn how to adjust tonal range in your scans or existing digital images using the levels-histogram tool
PAGE 3

DIGITAL IMAGE TONAL RANGE ADJUSTMENT USING THE LEVELS TOOL
The screen capture below is of the 'Levels' tool from Photoshop. This tool allows you to adjust the tonality of your digital image. It incorporates a histogram of the image. The levels tool has 3 adjustment sliders for white point, midtones and black point. Setting white or black point means assigning (re-mapping if you will) your very lightest and/or darkest current pixel values to pure white and pure black respectively. Or, as an alternative when appropriate, remapping the lightest and darkest existing pixels 'closer' to white or black. The Levels tool. also has color pickers (eyedropper tools) for setting pure white (alternate white point setting method), neutral grayscale and pure black (alternate black point setting method). You can select to view and adjust the RGB histogram (all three color channels at once) or each of the 3 color channels separately. The most commonly used adjustments are the 3 slider tabs just below the graph. There are also 6 informational boxes. There is a drop down box that allows you to choose the color channel/s to be used for the adjustment. You can choose RGB or R or G or B. The left side input levels dialog box lets you know the current numeric position of the left or 'black point' slider. The right hand input dialog box lets you know the current numeric position of the right hand or 'white point' slider. The middle input levels dialog box lets you know the adjusted gamma or 'midtone' number after moving the middle slider. The output levels sliders allow you to set the black point higher than 0 or set the white point to less than 255. The tonal area between black and white is adjusted automatically to balance with the new white or black point output setting. This tonal 'compression' option is useful when you need to lower the contrast in an image.
One of the most common uses of the levels too is expand the tonal range in an image (increase contrast). this can be done by shifting the pixels on the left of center of the graph downward to lower numbers and shifting the pixels right of center upward to higher pixels numbers. This action is called setting a new black and white point. Most images look best with a wide range of tonal values. How much you can expand the tonal range is limited only by the image's original tonal bias toward high or low key or midtone pixel distribution. Sometimes you may just want to set a new white point and sometimes you may want to set only a new black point. Once in a while you'll only need to shift the pixels that are in the area between the lightest and darkest area of your image.
 As an example, if your image does not have areas of dark shadows, there is no point in remapping the existing darkest pixels of your image all the way down to 0 or black. Referring to our grayscale color number disks on the previous page you will see that deep shadows that have some detail will show that detail with pixels numbers that average between 20 and 30. As an example on the other end of the graph, if your image does not contain clouds or any other components that should be close to pure white, there is no reason to remap the existing lightest pixels all the way to 255 or white. You will see decent texture in your highlight areas with pixel numbers that graph between 240 to 250. You will need some practice and experimentation before you get to the point where choices for new white and black point and midtone adjustments are intuitive. The 'auto levels' tool in Photoshop, also known as 'auto contrast' in some image editing programs, remaps the existing lowest number pixels to 0 and the existing highest number pixels to 255. Auto levels rarely produces the best tonal range for most images because it does not take into consideration image content or distribution of tonality in the image.

Proceed with caution when adjusting individual color channels with a levels tool as you may introduce unwanted color shifts using this approach. Conversely, adjusting individual channels carefully is an accepted method of removing unwanted color casts in some situations. We'll provide one example of individual color channel adjustment later in this article. You can also remove color cast in an image using the levels eyedropper tools. If you have an area in your image that  you know should be pure black with 0 on all color channels, pure white with 255 on all color channels or a midtone area that should be some level of grayscale on all color channels, select the appropriate eyedropper tool and click that area. The color numbers will be set to zero on all channels with the black eyedropper, equalized with the grayscale eyedropper and set to 255 on all channels with the white eyedropper. Remember that there is no viewable texture or detail in pure black or pure white so be sure to select the very lightest or very darkest pixels in your image if you choose to use the white or black eyedropper tool to set white or black point or remove color casts. If you use the grayscale 'picker' be sure the color you click on should actually be neutral grayscale at its current tonal level.

We will be using Photoshop's levels tool to demonstrate a levels adjustment. Other image editing programs may or may not have all the options for this tool that Photoshop has. Also, other programs may implement the levels tool with a different graphical interface. However, the concept, parameters and basic adjustments for the levels tool will be the same no matter which program you are using.

Lets go back to our desert scene and see if we can improve the tonality by adjusting this image with the levels tool. In the first example below we have the original image and levels tool showing the selected and unadjusted RGB histogram.

In this next example below we have moved the sliders to set new white and black points. We moved the black point slider to the approximate start of the slope of the graph on the left side, 23. This action remaps the original 23 tonal level pixels down to 0 or black. We set the white point slider to the approximate start of the slope on the right hand side, 242, which remaps the original 242 pixels up to 255. Notice that we now have an expanded histogram and the image has deeper shadows and lighter white clouds. We will now also have a few pixels that are pure black and pure white. When we review our new histogram, we'll want to make sure there are only a very few pixels at the 0 and 255 level. The tonal area between the new white and black setting is automatically expanded to compensate for the new white and black points. See the new (after adjustment) RGB histogram below the levels tool. Notice that we have just a few black and white pixels climbing up the margins of the new histogram.

You can see that the newly adjusted image now has a broader range of tonality with more pixels in the 0 to 23 range and more pixels in the 242 to 255 range. This adjustment automatically adjusted some of the lower midtone pixels to slightly darker numbers and some of the higher midtone pixels to lighter numbers. We have effectively increased the image's contrast. This adjustment has darkened our lower midtones just a little too much for my tastes.


Since we aren't too happy with the slight downward tonal shift in our lower midtones that occurred after we reset the new white and black point we will make another levels tool adjustment. In this adjustment we will move the midtone slider to the left to 1.10 and remap the tonal area between white and black to higher pixels numbers and a more visually pleasing tonal level. This midpoint adjustment could have been done at the same time the white and black points were reset. However it is important to note that you adjust the white and/or black point sliders before you adjust midpoint slider. This is because the pixels between the white and black points are always automatically adjusted (shifted) with each white and/or black point adjustment. We did the midpoint adjustment as a second and separate adjustment for this article to better illustrate the effects of doing a levels adjustment. See our final image below.
This image has had the midtone adjustment described above. The shaded area in the histogram in this illustration represents the histogram as seen above after setting white and black points but before midtone adjustment. The solid black area is the new histogram after midtone adjustments. Notice that the midtone 'hump' in the final image graph is now just about centered between 0 and 255. This is entirely appropriate for an image consisting mostly of midtone content.

It is useful to sample the highlight, shadow and midtone areas of your image with your imaging program's color picker (eyedropper tool). Knowing where the existing range of tonality is distributed within your image helps you make decisions on adjusting tonality. Here's another example scenario. If the brightest area of our midday outdoor photograph is an area of very dense very white clouds, and they read 175R,165G,165B, we have a red color cast plus clouds that are close to being light gray instead of white. To fix this we could add a little cyan to reduce the red influence. If you use this method you would make small adjustments and re-read that cloud area with the eyedropper tool until all three color numbers are as close to being equal as is possible. After you have removed the color cast set your new white point (dense white cloud area) to somewhere between 240 and 250 using the white point slider on the levels tools. Alternately, we could just open the levels tool, select the white point eyedropper and click on what should be the lightest and whitest portion of the clouds. This action would remove the color cast and set a new white point. The new white point would move the clouds up out of the 175-175-175 gray range into a lighter and brighter white range of 220-255 on all color channels.  Thin midday clouds may have a little blue influence (slightly higher number in the blue channel) in their color numbers because of the blue sky 'behind' them.

I'll give one example of individual color channel adjustment before we leave the histogram adjustment section. Remember our photo of the windfall apples on page 2 of this article. It had a slight warm cast due to late afternoon sun. The blue histogram was well to the left of center indicating its reduced influence on color balance. If we wanted to 'cool off' this image a bit, we could adjust the midtone slider of the BLUE channel histogram to the left to shift the blue pixels that are between 0 and 255 up (to the right) to higher tonal numbers. If necessary, we could also set a new white point on the blue histogram. These adjustments would give more dominance to the blue color channel and reduce the warm color cast. Doing the correction of the warm cast with this method would reduce the warm overall color cast of the image without reducing the red colors of the apples since we did not apply an overall 'cooling' color correction to all of the color channels as would have happened with a 'color balance' adjustment.There are two major advantages to using a 'Levels' tool over using brightness/contrast slider tools for tonal range adjustments. First, you can adjust the dark tones, midtones, and light tones of your image independently. Second, since you are using the image histogram as a guide in the levels tool, you can make sure you do not adjust your highlights too bright (too many pixels between 250-255) or your dark tones and shadows too low (too many pixels between 0-15).This page has outlined a basic levels adjustment approach that will work with just about any image. However, there are some limitations to the effective adjustment of tonality. The only major roadblock is if the original scanned image or out of camera image is way over or under exposed. Digital images are no different from film images in this regard. If there is a high number of pixels in the 255 range, your highlights are blown out. If there is a high number of pixels in the 0 range, you'll have little to no detail at all in your shadow areas. I've provided more example histograms, including over and under exposed image histograms on the next page of this article.

WORKING WITH 16 BIT (mode) COLOR

I'd like to discuss the importance of doing tonal range and color adjustments, whenever possible, in 16 bit mode. 8 bit mode is also known as 24 bit color since each pixel's color number for each of the three colors of red, green and blue is described by one 8 bit computer 'word' and 3 times 8 = 24. Since a bit is a single entity it can have only two states, on or off. It follows that 8 bits or a 'byte' can represent 2^8th power = 256. We can now see that 8 bit pixels have 256 steps from "color not used" to "all of the color used" for each color channel. Hence, every pixel of a 24 bit color image can have one of 256*256*256 = 16,777,216 different colors.16 bit mode is also called 48 bit color since each pixel's color number for each of the three colors of red, green and blue is described by one 16 bit computer 'word' and 3 times 16 = 48. So, each pixel has 2^16 power or 65,536 steps from "color not used at all" to "all of the color is used" for each color channel. 16 bit mode allows for 256 times more steps for each color channel. Every pixel in a 16 bit color image can therefore have one of 65,536*65,536*65,536 = 281 trillion different colors. (math and theory contributions in paragraph two and three of this section by Dirk Dittert).The amount of colors available in 16 bit mode is way more than the human eye can differentiate between or any printer can produce. However, this increase in color information becomes extremely important when you attempt to expand the existing tonality in your image. Color image tonality is nothing more than the subtle shading of colors. Aggressive color or tonal range adjustments in 8 bit mode will lead to gaps in the tonal range and result in banding in areas that should have smoothly blended transitions from one color to another.

 

To get us started understanding this concept have a look at the histogram of our desert scene when the same levels adjustments used above were applied after the image was converted to 8 bit mode. Notice the blank tonal areas that have absolutely no pixels residing within that graphical number. Notice the tonal areas that have been compressed and squeezed a bunch of pixels into one tonal area. These blank areas and spikes are sometimes referred to as a 'combing' effect due to their likeness to a hair comb.
It would be difficult to see any banding in the tonal gradations in our newly adjusted 8 bit mode desert scene due to the busy nature of the photograph. So, I have made some examples that will allow you to see the visual results of a histogram similar to the one above. For this exercise I made a simple blue to yellow gradient in 8 bit RGB color.
Note the original histogram. has no gaps and a very small combing effect. There is a smooth visual gradation between the blue to yellow transition.
In this example I applied the same levels adjustments that we made to our desert scene. Notice the gap filled histogram and the blocky visual transition from blue to yellow

For the highest quality image and most flexibility in post processing, scan to 16 bits per color channel R, G and B and adjust image tonality carefully in your scanning application. 'Post processing' refers to any adjustments done to the image after it was scanned or after it was taken in your digital camera. Photograph in RAW mode if you are interested in printing your photographs with maximum 'fine art' quality. If you have a 16 bit color capable image editing program, save your scans and/or digital camera images in 16 bit color. Disk storage is pretty cheap these days. Use your digital camera's thumbnail image and histogram to insure that you have proper exposure. Make your final tweaks to image color and tone curve (levels or curves adjustments) in your RAW converter before you convert the RAW image to JPEG (8 bits per channel color) for web or online use.

In the next section we will discuss digital camera histograms and some methods for interpreting your digital camera's thumbnail image and histogram.

NEXT

LINKS:
Histogram and RGB Tonal Range Explanation -Page 1
Histogram and RGB Tonal Range Explanation - Page 2
Interpreting Your Digital Camera's Thumbnail Image and Histogram

Web Site Links