GIF is the right format for images that are composed primarily of lines and solid blocks of color. Its compression scheme condenses repeated bits of the same color down to a single instruction that says, for example, "82 orange bits."
A GIF image's color palette is limited to a maximum of 256 colors. Use the GIF format for indexed images of 256 or fewer colors. The graphic must already be indexed with a color resolution of 8 bits or less to save it as a GIF.
Avoid using the GIF format for images with complex, subtle gradations of color. For these images, use JPEG instead.
The GIF file format also provides us with a couple of very useful features -- transparency and animation -- neither of which are supported by the JPEG format. PNG has transparency features, but does not support animation.
Transparency
When saving an image in the GIF file format, you can choose one (and only one!) color to be transparent. A transparent color is like a piece of clear glass; it is invisible and allows whatever is displayed "beneath" it to show through. Thus the GIF transparency feature enables you to create irregularly shaped images with the background showing through.
|
|
The images on the left are all the same transparent GIF, repeated nine times in a table, with each table cell set to a different background color. The transparency allows the color backgrounds to show through. |
|
|
Here's the GIF image without any transparency effect. See how the non-transparent white blocks the brown background from showing through? |
When you export a file as a GIF from your graphics program, transparency type is one of the options.
Animation
Without requiring your viewers to have any special browser plugin, the GIF format enables you to create and display animated images on your web page.
 |
This animated gif is made of a series of frames. The ability to animate is part of the GIF89a standard. |