GIF is a LOSS-LESS compression scheme. A loss-less compression scheme means that there is no loss of image information or quality when using this process to save and compress images; the image you save as a GIF is always reproduced identically everytime the GIF is displayed. Every pixel is recorded.
A GIF is created from an image that has been reduced to 8-bit (256 color) indexed color or less. As mentioned earlier, each reduction in bit-depth for color gives you 1/2 the possible color choices; 7-bit indexed color lets you have 128 possible colors, 6-bit color lets you have 64 possible colors, 5-bit color lets you have 32 possible colors, etc. The smaller the bit-depth of the indexed colors, the smaller your final GIF is going to be.
You should always reduce the indexed color bit-depth of your potential GIF to the lowest you can achieve before the image quality begins to deteriorate more than you can tolerate. At some point, as you reduce the number of colors available to the image, you are going to lose image integrity; the bit-depth cut-off point is an aesthetic decision which must be made on a case-by-case basis.
When choosing bit-depth, do so with an adaptive palette; perceptual and selective palettes are also fine. The Web palette option only chooses Web-Safe colors, which are OK for some GIFs and not OK for others; this palette limits the possible colors to a very narrow set (we'll talk about web-safe colors a little later).
Note: Never use full 8-bit color when making GIFs with adaptive, perceptual, or selective palettes; only use 7-bit palettes (128 colors) or less. This has to do with Windows-based PCs and their built-in 256 color system palette. Windows-based PCs have 20 reserved colors in their color palette (10 at the beginning of the palette and 10 at the end of the palette). If you create GIFs with a full 256 colors in each of their own palettes, Windows machines will sometimes substitute their reserved colors for the first 10 and last 10 colors in those GIFs 8-bit palettes, causing bizarre color substitutions which may ruin your images when they are displayed in web browsers operating under reduced color conditions (256 colors or thousands of colors).
A digital image destined for the Web is composed of a grid of pixels at 72 pixels per inch resolution, as you know. When compressing images, GIF compression scans from left to right across each line of pixels; all consecutive pixels which are the same color are stored as one unit of data; this unit of data also includes the position on the indexed color palette for the color for that group of pixels. Each time there is a change of color moving from left to right across a line of pixels, that pixel (or group of pixels) is stored as a separate unit of data.
I've created a Flash movie which illustrates GIF Compression in Action. This Flash movie depicts the compression of one line of pixels from an image file, so that you can readily understand how GIF compression works.
GIF compression is excellent for graphics which rely on flat color space and sharp edges because of the way it stores information. The loss-less compression of the images reproduces the original graphic perfectly, and is great for sharp lines and clean edges.
Images with continuous-tone color, like photographs, do not compress efficiently using GIF compression; JPEG compression is a far better choice for photographs (as we will discuss later). That doesn't mean that you can't use GIF compression on photographs, it just means that, usually, JPEG compression is more appropriate.
When creating GIFs, make certain that you don't DITHER the image, as this will cause GIF compression to work less efficiently.
Copyright © 2001 Michael Masumoto. All Rights Reserved.