Jump to content

GIF

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Patrick (talk | contribs) at 01:28, 24 February 2004. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

GIF (Graphics Interchange Format) is a bitmap image format that is widely used on the World Wide Web, both for still images and for animations.

"GIF" is often pronounced giff with a hard g (that is, like "gift" without the final t), but the correct pronunciation as specified by the creators of the file format in the official documentation is jiff. Arguments over the proper pronunciation of GIF have become a popular stereotype of computer geek society.

GIF was introduced in 1987 by CompuServe in order to provide a color image format for their file downloading areas, replacing their earlier RLE format which was black and white only. GIF became popular because it used LZW data compression, which was more efficient than the run-length encoding that formats such as PCX and MacPaint used, and fairly large images could therefore be downloaded in a reasonable amount of time, even with very slow modems.

The optional interlacing feature, which stored image scanlines out of order in such a fashion that even a partially downloaded image was somewhat recognizable, also helped GIF's popularity, as a user could abort the download if it was not what was required.

Colour

GIF is palette based: although any colour can be one of millions of shades, there are only a limited number of colours available (maximally 256), which are stored in a 'palette', a table which associates each colour number with an actual colour value. The limitation to 256 colours seemed reasonable at the time of GIF's creation because few people had the hardware to display more. Typical line drawings, cartoons, grayscale photographs, and similar graphics need only 256 colours.

There exist ways to dither colour photographs by alternating pixels of similar colours to approximate an in-between colour, but this transformation inevitably loses some detail, and the algorithms to select colours and to perform the dithering vary widely in output quality, giving dithering a possibly unwarranted bad reputation. Additionally, dithering significantly reduces the image's compressability and thus works contrary to GIF's main purpose.

A variation using the multiple images feature to draw each scanline in a separate palette can store any RGB colour out of 16 million, but this takes even more space than an uncompressed Windows bitmap and is useful only where lossless true colour is required.

One colour entry in a single GIF image's palette can be defined as being transparent. This means that when the decoder encounters a pixel with this value, it is rendered completely transparent. The crude effect this has is that an image can appear to have a non-rectangular shape.

History

The original version of GIF was 87a. In 1989, CompuServe devised an enhanced version, called 89a [1], that added support for multiple images in a stream and storage of application-specific metadata. The two versions can be distinguished by looking at the first six bytes of the file, which, when interpreted as ASCII, read "GIF87a" and "GIF89a", respectively.

When the World Wide Web took off, GIF became one of the two image formats commonly used on Web sites, the other being JPEG. Most Internet browsers at this time did not support any other image formats, not even uncompressed Windows bitmap files, to discourage web designers from using files larger than necessary.

The GIF89a feature of storing multiple images in one file, accompanied by control data, is used extensively on the web to produce simple animations.

Unisys and LZW patent enforcement

The LZW compression algorithm on which GIF is based was patented by CompuServe and Unisys, in U.S. patent 4,558,302. Before 1994, however, the companies did not charge any royalties for the use of the format, which probably helped it gain popularity.

At the end of December 1994, however, CompuServe and Unisys announced that they would start collecting royalties on that patent; all commercial programs capable of producing GIF files would be required to pay a license fee to Unisys.

By this time, GIF was in such widespread use that most companies producing these programs had little choice but to pay. The desire for a format with fewer legal restrictions (as well as fewer technical restrictions such as the number of colours) led to the development of the PNG format, which has become the third common image format on the Web. (The first two are GIF and JPEG.)

In late August 1999, Unisys terminated its royalty-free LZW technology licenses for free software and non-commercial proprietary software and even for individual users of unlicensed programs, prompting the League for Programming Freedom to launch the Burn All GIFs campaign to inform the public of the alternatives.

On June 20, 2003, the United States patent on the LZW algorithm expired, which means that Unisys and Compuserve can no longer collect royalties for use of the GIF format in that country. Those bothered with the patent enforcement dubbed this day GIF Liberation Day. The equivalent patents in Europe, Japan, and Canada, however, won't expire until June 18, June 20, and July 7, 2004 respectively.

IBM has also patented the LZW algorithm, but has never enforced this patent.

Comparison with PNG

The PNG format was specifically designed to replace GIF for use as a single-image web format. PNG offers better compression and more features than GIF, and all popular web browsers support PNG images.

PNG increasingly replaces GIF for still images, mostly on web sites of computer enthusiasts protesting Unisys's license policies and on some cartoon sites that take advantage of PNG's tighter compression to save on Internet bandwidth charges.

Older web browsers support all of the PNG features GIF also has, except animations. Therefore most GIF images could be replaced by PNG images. Except in the most recent versions Internet Explorer does not support PNG's 8-bit alpha transparency, a feature absent from GIF images (which only provides 1-bit transparency, i.e. pixels are either fully transparent or fully opaque).

MNG, the animation-supporting relative of PNG, has only recently reached version 1.0 and few applications support it, so it has had little impact on the use of GIFs for animation. Today animations may be the only field where GIF is needed, because of the lack of web browser support for MNG.

Miscellaneous

The MIME media type for GIF is image/gif (defined in RFC 1341).