logo About gamma correction


What is gamma correction? Some of the images on this server, especially the older images, are not gamma corrected. In other words, they are not corrected for the nonlinear relationship between pixel value and displayed intensity that is typical for a color television monitor. This nonlinear relationship is roughly a power function, i.e. displayed_intensity = pixel_value^gamma. Most monitors have a gamma between 1.7 and 2.7. Gamma correction consists of applying the inverse of this relationship to the image before display, i.e. by computing new_pixel_value = old_pixel_value^(1.0/gamma).

Who is responsible for applying gamma correction? If you are viewing these images on a Silicon Graphics (SGI) workstation, the IRIX operating system applies gamma correction for you by loading a colormap into the display hardware that recomputes pixel values on their way to the monitor using the second formula given above. In this case, our older images will look fine to you. If you are viewing these images on a Mac, PC, or most other workstations, then you must configure your video card, browser, or external image viewer application to apply gamma correction (see below for instructions). If your system cannot be configured to apply gamma correction, then you must download our images and correct them yourself, e.g. by applying the second formula in software. If you do none of these things, then our older images will look too dark to you.

How do I know if my system is applying gamma correction? Look at the two images above. The left image is not gamma corrected. It looks fine on an SGI, but too dark on a PC. In particular, on a PC the sky in the upper-right corner looks inky, almost as dark as the trees. The right image has been gamma corrected to 1.7. It looks fine on a PC, but washed out on an SGI, so washed out that you can see noise from this early-model digital camera in the black jackets.

How do I configure my system to apply gamma correction? If you have configured your browser to launch an external viewer like "xv" to display your images, you can ask it to apply gamma correction for you. For example, if your browser is Netscape Communicator, your image viewer is xv, and the gamma of your display monitor is 2.0, then you can ask xv to apply gamma correction as it displays an image by changing the invoking command in Netscape to "image/*; xv -gamma 2.0 %s". To find out the gamma of your monitor, look at the hardware specifications that you threw away on the day you unpacked the monitor. Some operating systems and programs provide an interactive utility to help you determine your monitor's gamma, typically by asking you to change the brightness of a gray patch until it matches an adjacent checkerboard of black and white squares that, if you squint to blur the checkerboard pattern, simulates a 50% gray. As mentioned earlier, most monitors have a gamma between 1.7 and 2.7. Fortunately, the world of computer monitors is slowly converging on a gamma of 2.2.

I don't use an external viewer. What else can I do? If you use your browser to display images, rather than an external viewer application, there is currently, and unfortunately, no way to configure browsers to apply gamma correction. In that case, you'll have to change the gamma of your entire system. If you use a PC and Windows, the "Display" control panel may, for some video cards, allow you to reset your video card's gamma to compensate for your monitor. If you use a PC, Linux, and XFree86, it has a program called "xgamma" that will allow for XServer-wide adjustment. (Thanks to Seth Nickell for pointing this out.) If you use a Mac running OS 9 or later, the Monitor control panel includes a way to set your display system's gamma. For older Macs, there are programs available that will do the same thing.

A subtlety. Silicon Graphics workstation monitors have a gamma of 2.4, but they perform gamma correction as if the monitor had a gamma of 1.7. This yields a residual gamma (as seen on the monitor) of 2.4 / 1.7 = 1.4. This is called the system gamma, and it is intended to compensate for the fact that the images you are viewing typically represent brightly illuminated scenes, but you typically viewing them while seated in a dimly illuminated room, which changes the transfer characteristics of your eye. The bottom line is that, if you are forced to apply gamma correction, you should experiment to find a gamma that suits your tastes.

The catch. There is no accepted standard for embedding into image files a field saying whether or not the image has been gamma-corrected, and for what value of gamma. Without knowing this information, it's impossible to know whether or not you need to reset your display's gamma, and to what value. Even among images on a single web site, differing gammas may be present, depending on what system they were authored on. For example, we in the Stanford Computer Graphics Laboratory are gradually moving from SGIs to PCs. As we do, we find ourselves increasingly looking at uncorrected displays, so our old images look dark even to us. Worse, as we create new images, we are now unconsciously tuning them to include gamma correction so that they look acceptable on an uncorrected display. It's a mess.

How will it end? Fortunately (or unfortunately), PCs are quickly taking over the world, including the world of high-performance 3D graphics. As they do, it becomes gradually safer to assume that people are looking at uncorrected displays. In this new world, images should be adjusted to include gamma correction. If you are a creator of images, and your tools are a digital camera and Photoshop, then as of this writing (Summer, 2001), that particular production chain seems to yield images that look good on uncorrected displays. If your tools are a 3D rendering program, then (depending on the program) you might be computing so-called linear-luminance images. These images need to be gamma corrected for display or they will look too dark.

For more information. For a general introduction to the fascinating subject of gamma correction, refer to a computer graphics textbook such as Foley, van Dam, Feiner, and Hughes, Computer Graphics: Principles and Practice, second edition, Addison-Wesley. For a detailed treatment of gamma correction in broadcast television systems, see Pearson, D.E., Transmission and Display of Pictorial Information, Halsted Press, 1975.


Copyright © 1994 - 2002 Marc Levoy
Last update: January 15, 2003 10:27:22 PM