![]() |
New Perspectives on HTML and XHTML Tutorial 3 |
GIFs are limited to a palette of 256 colors. If a graphic is converted to the GIF format,
colors that lie outside of that palette are approximated using a process called
dithering. In the dithering process,
alternating pixels of similar colors approximate the original color's appearance. Dithering
can cause GIFs to appear with jagged edges and fuzzy colors. To avoid dithering, you can
limit your GIFs to only use colors from the safety palette.
The safety palette is a collection of 216 colors that are guaranteed to be displayed
without dithering. The palette limits the red, green, and blue components to
the values: 0, 51, 102, 153, 204, and 255. Thus a color value like (204, 51, 153) would be
part of the safety palette, but (192, 124, 255) would not. The tables below show all of the
colors of the safety palette along with the values of their red, green, and blue components.
Note that the safety palette is only required for GIFs. Other graphic formats such as JPEG
and PNG support higher color resolutions and thus will not have to employ dithering to
display colors outside of the safety palette.