GIF (Graphics Interchange Format) is an image
format developed by CompuServe and is the most common type of image
format used on the Web. It was developed as a way to store images
in small files that can be quickly exchanged and easily downloaded.
GIF files have a color depth of 8 bits per pixel, so the image must
be in Index color mode in order to be saved as a GIF. The word pixel
is short for picture element, the smallest unit of a digital picture.
8 bits per pixel makes a total of 256 different colors (see color
bit depth). GIF files can be accurately displayed on a greater
number of systems, as most systems can display at least 256 colors.
GIF files are also saved as low-resolution, usually 72 ppi. The GIF
format should never be used for images that will be professionally
printed. If you have an image you would like to put on the web and
also printed, you will need to save two separate files, one as a GIF
and one as a TIFF or EPS.
GIF compression is known as a "lossless compression"
method, in which the image is analyzed and compressed without
the loss of the original picture data. The GIF format is best suited
for items like logos, banners, buttons, and graphics, because most
of these items are designed with the 256 color palette (8-bit color).
If the items are saved as a GIF, none of the original color data will
be lost. If the GIF format is used for an image that is larger than
8 bit color, such as a photograph, then the colors in the image that
are not found in the 8-bit color palette will be dithered.
There is no problem with dithering the colors except that it creates
a much larger file size because there is more information to store
due to the number of extra pixels required to create the dithered
The compression technique used with GIF is called
LZW compression, which stands for Lempel, Ziv, and Welch. Lempel,
Ziv, and Welch are the mathematicians who were the inventors of this
technology. The computer maker Unisys holds the patent on LZW file
compression technique which means that anyone creating GIF files should owe
Unisys a licensing fee for the use of the LZW compression technology.
Most software programs like Adobe Photoshop® and Macromedia Fireworks®,
that are used to create GIF files, are already licensed by Unisys,
so most people should not have to worry about it.
A technique called "run length encoding"
is used in GIF compression. The "run length encoding" technique
records the color changes of each horizontal line of pixels, from
left to right. If a complete row of pixels is of one color, then there
is less data to record. When there are fewer color changes per row
of pixels, the result will be a smaller GIF file and a faster loading
time. If the file size and the loading time are of a major concern,
then large amounts of extra vertical detail should be avoided. In
the example shown below, a border of stripes was added to each identical
GIF image. The image with the vertical stripes on the left, will cause
the file size to be larger because there are more color changes to
record on each horizontal row of pixels. The horizontal stripes on
the image on the right, create a smaller file because there are fewer
color changes running horizontally along the image.