If the file contains just one image, the header is usually followed by a global color table defining the colors in the image. In a GIF87a file, the header and global color table are followed by the image, which may be the first of several images strung end to end. Each image consists of a 10-byte image descriptor followed by an optional local color table and then the bitmap bits. For space efficiency, bitmap data is compressed using the LZW compression algorithm. GIF89a files are structured similarly, but they can also include optional extension blocks containing additional information about each image.
Extension blocks can appear virtually anywhere in the file after the global color table.
GIF's primary strengths are its widespread popularity and its compactness. But it has two rather severe weaknesses. One is that images stored in .GIF files are limited to a maximum of 256 colors. The resulting legal morass is a disincentive for programmers to implement support for .GIF files in their graphics applications.