ImageGear for Java User Guide > ImageGear Imaging Formats Reference > ImageGear Supported File Formats Reference > GIF |
Full Name | CompuServe Graphics Interchange Format (GIF) |
Format ID | ImGearFormats.GIF |
File Extension(s) | *.gif |
Data Type | Raster image |
Data Encoding | Binary |
IG Multipage Support | Yes |
IG Alpha Channel Support | No |
IG Platforms Support | WIN32, WIN64, Linux32, Linux64, MAC32, MAC64 |
ImGearCompressions.LZW - Indexed RGB: 1, 4, 8 bpp
ImGearCompressions.LZW - Indexed RGB: 1, 2, 3, 4, 5, 6, 7, 8 bpp
Filter Control Parameter | Type | Default Value | Available Values | Description |
Version | int | 89 | 87; 89 | Sets version of GIF file to be saved. |
Interlace | boolean | false | true, false | Sets GIF interlace mode to be used on saving. |
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 See PNG. section of this chapter 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.
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.