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. It was introduced in 1987 by CompuServe. "GIF" is often prounced giff with a hard g (that is, "gift" without the final t), but the official pronunciation is jiff.
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 the could abort the download if it was not what was required.
Most GIF images can have at most 256 colours, but when the format first appeared this was not a significant limitation, as few people had the hardware to display more. Typical line drawings, cartoons, grayscale photographs, and the like 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 colors and to perform the dithering vary widely in output quality, giving dithering a possibly unwarranted bad reputation. (A variation using the animation 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 and the designer cannot count on support for PNG images.)
The original version of GIF was 87a. In 1989, CompuServe devised an enhanced version, called 89a, that added support for animation 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 File Interchange Format.
At the end of December 1994, CompuServe and Unisys announced that the U.S. patent which Unisys holds for the LZW compression algorithm would be enforced for GIFs: 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 up. These problems led to the development of the PNG format, which has become the third common image format on the Web. 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.
PNG offers better compression and more features than GIF, and most popular web browsers now support PNG images. But as of 2001, PNG has only slowly begun to replace 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. The primary advantage of GIF over PNG for still images is compatibility: older browsers (up to and including early 4.0 releases of) have little or no support for PNG images. MNG, the animation-supporting relative of PNG, has only recently reached version 1.0 and few applications support it, so it has made little impact on the use of GIFs for animation.
The MIME media type for GIF is image/gif (defined in RFC 1341).