ImageGear for C and C++ on Linux v18.8 - Updated
GIF
User Guide > File Formats and Compressions > File Formats > File Formats Reference > GIF

Full Name CompuServe Graphics Interchange Format (GIF)
Format ID IG_FORMAT_GIF = 14
File Extension(s) *.gif
Data Type Raster image
Data Encoding Binary
Color Profile Support No
Multi-Page Support Yes
Alpha Channel Support No
ImageGear Platforms Support WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC
To support the GIF format, attach the ImageGear LZW Component to Core ImageGear. See Attaching Components.

ImageGear Supported Versions:

ImageGear Supported Features:

ImageGear Read Support:

IG_COMPRESSION_LZW - Indexed RGB: 1, 4, 8 bpp

ImageGear Write Support:

IG_COMPRESSION_LZW - Indexed RGB: 1, 4, 8 bpp

ImageGear Filter Control Parameters:

Filter Control Parameter Type Default Value Available Values Description
VERSION INT 89 87; 89 Sets version of GIF file to be saved.
INTERLACE AT_BOOL FALSE TRUE, FALSE Sets GIF interlace mode to be used on saving.

Comments

To see the complete frame of an optimized GIF you can use the Multimedia component along with IG_mult_current_frame_seek.

This is a very popular format for storing graphics images on Web pages. It is also supported by most applications that handle graphical image data.

Unisys, the owner of the LZW compression used on all GIF files, declared at the end of 1995 that it will charge a royalty fee to all developers wishing to use this compression scheme. (This drove many developers to search for a replacement file format. A new file format called PNG ("Ping") was created. The PNG format is supported by ImageGear; see the PNG section for more information.) However, worldwide GIF-related patents expired in 2004 and the format is once again free to use without the need to pay royalties to Unisys.

While the GIF format is designed to store multiple images, few GIF format viewers support this. For this reason, it is not advisable to store more than one image in a GIF file.

The GIF layout is fairly complex; it can include several categories of "blocks" under which subcategories of blocks may occur.

For both the 89a and 87a versions, the first three blocks are the header, the Logical Source Descriptor, and the Global Color Table. The header simply identifies the file as a GIF and gives the version number. The Logical Source Descriptor is very similar to a header, and is sometimes stored within the header. It contains information about the display screen and color table.

GIFs contain two kinds of color tables: a "Global Color Table" and "Local Color Table." The Global Color Table is used as a table for the pixel values of all images contained within the GIF file. Optionally, the Local Color Table block that is provided for each image can contain data specific to an individual image.

In addition to a local color table, each image is associated with another block of data, the Local Image Descriptor, provides the size and location of the image, and data about its color table.

GIF89a is equipped with four new types of blocks called "Control Extensions". The most significant group of these are the "Graphics Control Extension Blocks" that enable the simultaneous storing and displaying of textual and graphical data, including multiple images, resulting in a "multimedia presentation". The functions provided by these blocks include setting the transparency or opacity of the images, restoring or deleting images, and overlaying captions (that are not part of the actual bitmap) on images.

GIF image data is always stored in LZW-compressed form. The data may also be interlaced. Interlacing helps the appearance of an image as it displays while being decompressed, so that it "fades in". In a non-interlaced file, the presentation of the image data begins with row 1 and works downward to the last row of data. This method of display does not allow a quick preview of the whole image. When the data is interlaced, the lines are saved and displayed out of sequence. Every fourth row is displayed first and then filled in with every remaining fourth row, until all of the lines are displayed. This allows the eye to perceive the basic subject of the whole image before it is completely displayed.

See Also:

GIF Non-image Data Structure

References Used

Brown, C. Wayne, and Barry J. Shepherd. Graphics File Formats: Reference and Guide. Greenwich, CT.: Manning Publications, 1992.

Murray, James D. and William vanRyper. Encyclopedia of Graphics File Formats. Sebastopol, CA: O'Reilly & Associates, Inc., 1994.