Using Palettes

Traditionally, a palette was a surface where an artist mixed colors before applying them to the canvas. In computer graphics, a palette is somewhat similar. Most graphics programs have a window where you can pick your colors. In certain circumstances, your color choices are limited. Those limited sets of colors also are referred to as palettes .

Palettes are more important when working with GIF images. Because of their limited color depth, GIF images can use only a select palette. This palette, though, can contain a different selection of colors. Sometimes you have control over the selection of the colors and, unfortunately , sometimes you don't.

Problems with Limited Palettes

One problem associated with limited palettes is that, if you choose to work with a limited palette while creating your images, many of the features of your graphics programs will not be available to you. Options such as drop shadows and blurring need to have access to the full range of colors to do their magic. The alternative here is to create your image using higher color depth and then reduce the depth.


You should always keep a copy of the image with the greatest color depth and highest resolution. This extra copy makes applying subsequent changes much easier. Saving your image as a BMP, an uncompressed TIF, or a PCX, for example, is something you should always consider doing. These formats, which are "lossless" because they store all the information about the image rather than trying to condense it, tend to take up a little more room, though, so you also might want to consider having some sort of backup system if you're going to be creating lots of images.

How to Build or Select a Palette

When you open an image that uses 4- or 8-bit color, such as a GIF, a limited palette containing the colors in that image is created, and displayed on the Color Palette. A limited palette is also created whenever you reduce the color depth of an image to something below 24-bit. This palette, called the Image Palette, lists the colors available to you for that image. You can open up the Image palette and add, edit, or remove colors from it. Figure 42.16 shows the Edit Palette dialog box from Paint Shop Pro. (You can display this dialog box by choosing Colors, Edit Palette from the menu.)

Figure 42.16. The Edit Palette dialog box.


Double-clicking one of the colors in the Edit Palette dialog box brings up the Color dialog box (see Figure 42.17).

Figure 42.17. The Color dialog box.


You can change the color you double-clicked to any one of 16.7 million other colors. In Paint Shop Pro, just enter the RGB values in the boxes in the lower-right corner of the dialog box. This new color is then available in the palette. Note that the HSL model is available in the Color dialog box, as well.

Exact Palette

The exact palette is built from the colors currently being used in an image. If the number of colors exceeds that for the palette you're building, you can change some of the colors to others that are similar or you can allow the program to dither the colors for you. Normally, this becomes an issue only when you need to convert the image to a lower color resolution mode before saving the image.

Adaptive Palette

Most Web browsers use an adaptive palette when loading an image that doesn't fit their own color palettes. There are a few gotchas involved here, though. You'll be okay if all the images share the same palette. If, on the other hand, you have a couple of images that use different palettes, you might find that your images have dithered terribly.

The problem is that while you're working on your images, you're probably working on them one at a time, right? So you create one image, save it, and go on to create the next one. You get this great idea for a different set of colors and create the second image with a completely new color scheme from the first. You then save the image after adjusting the mode appropriately. Still no problem.


To avoid the problem described here, you can create one image for a Web page, save the colors used in an image (the Image Palette) to a file, and then load that palette of colors for your next image. To save the Image Palette, choose Colors, Save Palette.

You then sign on to the Internet and load your Web page. Oh-oh! The colors on both images look really bad. What happened? Well, what happened is that if the browser is running on an 8-bit setup, it can't show you 256 colors from one image and another 256 from the next. It can display only 256 different colors at one time. This limitation brings us to the dreaded Netscape or Web palette.

Web Palette

The Web palette is the scourge of Web graphics artists the world over. This palette consists of 216 colors that, if used when constructing your images, display your images the same way on every platform.

I say scourge because 216 colors is not very many, and the color choices are abysmal. For example, there are only 6 shades of gray.

Why 216 colors and not 256? Because the operating systemWindows, for exampleand the browserNetscape, let's sayuse 40 colors between them, which leaves 216 colors. This palette is sometimes called the cube , which refers to its being a 6x6x6 cube: six colors wide, six colors high, and six sides (6 times 6 times 6 equals 216).

Because of the popularity of Web graphics, many graphics programs now include a version of the Web palette, Paint Shop Pro included. Although this feature makes the process of creating images that use this set of colors easier, it doesn't change the fact that you are limited to this particular color set.

So, what can you do? One answer is to use your own set of colors, being careful that all your images use the same restricted palette. The other option is to hope that many readers of your pages will be using machines capable of displaying more than 256 colors. This may be a pretty safe bet, considering that most people are using computers that contain graphics cards capable of displaying colors in at least 24-bits.

Of course, you could build your graphics with these limitations in mind and take them into account when the images are really important for navigation around your site.

Loading a Palette

Paint Shop Pro comes with several palettes you can use to create your images, including its Safety (Web) palette. To load one of these pre-made palettes (or an image palette you've saved on your own), follow these steps:

  1. Choose Colors, Load Palette.

  2. Change to the folder that contains the palette you want to use. Paint Shop Pro keeps its pre-made palettes in the \Program Files\Jasc Software Inc\Paint Shop Pro 7\Palettes folder.

  3. Select the folder you want to use and click OK. The colors in the image and on the Color Palette are changed to the limited colors in the palette.

Sams Teach Yourself Internet and Web Basics All in One
Sams Teach Yourself Internet and Web Basics All in One
ISBN: 0672325330
EAN: 2147483647
Year: 2003
Pages: 350
Authors: Ned Snell © 2008-2017.
If you may any questions please contact us: