Getting More Than 16.7 Million Colors
Through Gamma Adjustments

A 24 bit color system can display 2^24 or 16.7 million colors simultaneously. However, the same hardware may be capable of displaying many more colors, just not more than 16.7 million simultaneously. Anyone who has worked on an 8-bit color system (256 colors) knows that they can display 256 colors at any given time and can change their palette of 256 colors as their needs change. Similarly, people with 16-bit colors systems (65536 colors) can display more than 65,536 colors by chaining their palettes. With 24 bit color systems, many people overlook this option of rearranging their palette. Most software doesn't explicitly tell a user how to change the palette and low end graphics cards may not allow the capability to extend the palette to a different set of 16.7 million colors. But if you work with 16 bit color, 8 bit color or have a really nice graphics card with a 10-bit DAC or 12-bit DAC (Digital Analog Converter) it would behoove you to take note of this palette switching capability.

Bit Division

One very effective way of changing the palette is by dividing up the 24 bits differently among the red, green and blue channels. Typically the red, green, and blue channels are each assigned 8 bits of color. Should a user desire more control over the colors in one channel, however, these bits could be divided differently. Had Monet been a computer artist while doing his studies of blue, he could have assigned 10 bits to blue, and 7 each to red and green, thereby offering a more blue palette. Since most graphics applications and file formats do not support this method, however, it is not very practical to implement, unless you are a computer programmer writing your own graphics package.

Gamma Encoding

The second method of palette control is to change the mapping between the bit values and their corresponding CRT voltage. A crude way to do this is to adjust the brightness and contrast knobs on your monitor. A more elegant and reproducible way of doing this is to adjust the gamma value associated with the image file. (What is Gamma Anyway )Bit division changes the number of blues, relative to the number of reds and greens. By gamma adjusting, one changes not the NUMBER of blues (or reds, or greens) but the SET of blues, reds and greens available.

Photoshop Experiment

The two images below were made in the Windows version of Adobe Photoshop in RGB mode. (Note this will not work in the same way on the Macintosh version of Photoshop) In the first image, the Photoshop Gamma Setting (Found under the File Menu under Monitor Setup) was set to 1.0. This implies that the file is gamma corrected to 1.0, or that the File Gamma is 1.0. The second image was made by copying the first, and setting the Photoshop gamma value to 2.5. Both images are grayscales from 128 to 255. On some computer systems on which I have viewed this page (those with low system gammas like SGI's), the top image looks entirely white. This further shows how important proper gamma correction can be.

When these images were made in Windows Photoshop, the R,G,B values of each image were identical. That's right. The image data for both of them were identical. Actually, since viewing them properly requires changing the gamma (thus changing the palette), both images appeared exactly the same at all times in Photoshop. The images below are only a simulation of what was seen. (Tell me how to repeat the experiment)

Obviously one image is darker and the other is lighter. The more colors a computer system has, the harder it is to tell the difference between individual shades of gray in both images. Clearly the lighter image represents a greater challenge in color differentiation. It would very difficult (impossible on 24-bit systems) to tell the difference between the shade of "almost white" made by r=g=b=250 and that made by r=g=b=251

Because both of the above images were made from identical RGB image data, we see the importance of gamma selection with regard to palette control.

In the lighter image (the File Gamma = 1.0 image) the palette made by setting the gamma value of Photoshop to 1.0 offers tremendous amounts of subtlety and control over different shades of "almost white". The darker image (the File Gamma = 2.5 image) is not quite so subtle and offers the artist fewer choices from the "almost white" section of the palette. In 24-bit systems this amount of control may or may not be overkill, depending upon the subject. It must be remembered that overkill in one area of the spectrum will mean fewer colors in another part of the spectrum. This may be desirable in some situations and the artist should plan carefully.

But what about the low end? I made a similar test for shades of gray between 0 and 128. Here the opposite is true. In the "File Gamma = 1.0" version, the image is again lighter and we see the price that is paid for having so many high end shades: There are very fewer dark colors to work with. In the "File Gamma = 2.5" version the image is darker as we expect and we see where all of the shades that were missing at the high end went to. The "File Gamma = 2.5" version has the same subtlety and control that was seen at the high end in the "File Gamma = 1.0" version. Click here to see this second test against a white background.

What this experiment shows is that we are really changing the palette of colors available to us. If we set the file gamma equal to 1.0 we emphasize the bright end of the spectrum, and higher gammas emphasize the lower end of the spectrum. It would be impossible to reproduce the colors seen when gamma is set to 1.0, with the colors available when the gamma is set to 2.5.

Note: not just gray scales are affected by this. This is just a very obvious example. By selecting a specific gamma, the palette is changed for all colors in most color spaces or modes. ( More about how Gamma Affects Colors) Ideally, applications like Photoshop should allow for separate gammas for each color channel. This would afford even greater palette selection power.

Is Gamma Best?

A good question to ask, now that it is seen how gamma can change the palette, is whether or not gamma selection is a good means of palette selection. The graphics cards in some systems allow for independent gamma correction on all three color channels. Some even allow for user defined "gamma" curves. These curves can take on any shape the user desires, and as such are really not gamma curves because they may not be exponential. Nonetheless they perform the same function. Ultimately, the best tool is one that gives the user as much control as possible in choosing the mapping of RGB values into CRT voltages.

File Formats and the WWW

Changing the gamma for a specific file can be a wasted effort, however. Most file formats, GIF, JPEG, TIFF and Photoshop PSD have no way of encoding the gamma of a file. This unfortunate problem rears its ugly head on images all over the WWW. A new graphics format called Portable Network Graphics (PNG) hopes to solve this problem as well as others associated with making WWW graphics. More about making graphics for the WWW

Thanks

My thanks to David Moe at Radius Corp. for helping me out with this one. Radius happens to make graphics cards for the Mac that have a 10-bit DAC.



copyright CGSD Corp., updated November 1, 1998, www.cgsd.com