Web image format: GIF

When you're working with Web image formats, find out if the Graphics Interchange Format (GIF) is best for you.

By Paul Anderson

CompuServe's Graphics Interchange Format (GIF) compresses images in two ways. First, it uses something called Lempel-Ziv encoding, which counts rows of like-colored pixels as a single unit. Second, it limits itself to indexed color. This means that a GIF can have no more than 256 colors, so you may have to reduce the colors in your images to use it. That's why GIF doesn't work well for photographic or high-color images.

GIFs with sufficiently few colors realize greater compression: 128 or fewer colors are referenced with 7-bit data; 64 or less with 6-bit data; and so on, down to a 1-bit, two-color GIF. This makes GIF an optimal format for simple line art, and that means there are limits and rewards to adding or removing colors. GIF has a few unique features. A GIF file can contain several images, along with a duration value for each one, to produce animation. It also has limited transparency: one color in an image's palette can be designated as transparent. This is an either/or arrangement; pixels with colors close to the transparent one will not be partially transparent.

Both of these images are less than 2.42K

GIF (2,440 bytes) JPEG (2,469 bytes)

Paul Anderson is associate technical editor for CNET His responsibilities don't include handling graphics, so naturally, he handles them all the time.

Editor's Picks