- Graphics Interchange Format
Infobox file format
name = Graphics Interchange Format
caption = A rotating globe in GIF format. The gradient blue areas of this image transition choppily, a common artifact produced when dithering is not employed.
extension = .gif
mime = image/gif
type code = GIF
GIFf
uniform type = com.compuserve.gif
magic =GIF87a
/GIF89a
owner =CompuServe
genre =Raster graphics image format
container for =
contained by =
extended from =
extended to = The Graphics Interchange Format (GIF) is a bitmap image format that was introduced byCompuServe in 1987 and has since come into widespread usage on theWorld Wide Web due to its wide support and portability.The format supports up to 8 bits per pixel, allowing a single image to reference a palette of up to 256 distinct colors chosen from the 24-bit RGB color space. It also supports animations and allows a separate palette of 256 colors for each frame. The color limitation makes the GIF format unsuitable for reproducing color photographs and other images with continuous color, but it is well-suited for simpler images such as graphics or logos with solid areas of color.
GIF images are compressed using the
Lempel-Ziv-Welch (LZW)lossless data compression technique to reduce the file size without degrading the visual quality. This compression technique was patented in 1985. Controversy over the licensing agreement between the patent holder,Unisys , and CompuServe in 1994 inspired the development of thePortable Network Graphics (PNG) standard; since then all the relevant patents have expired.History
CompuServe introduced the GIF format in 1987 to provide a color image format for their file downloading areas, replacing their earlierrun-length encoding (RLE) format, which was black and white only. GIF became popular because it used LZWdata compression , which was more efficient than the run-length encoding that formats such asPCX andMacPaint used, and fairly large images could therefore be downloaded in a reasonably short time, even with very slowmodem s.The original version of the GIF format was called 87a. In 1989, CompuServe devised an enhanced version, called 89a, [http://www.w3.org/Graphics/GIF/spec-gif89a.txt] that added support for multiple images in a stream, interlacing and storage of application-specific metadata. The two versions can be distinguished by looking at the first six
byte s of the file, which, when interpreted asASCII , read "GIF87a" and "GIF89a", respectively.GIF was one of the first two image formats commonly used on Web sites, the other being the black and white
XBM .Fact|date=February 2007JPEG came later with theMosaic browser .The GIF89a feature of storing multiple images in one file, accompanied by control data, is used extensively on the Web to produce simple animations. The optional interlacing feature, which stores image scan lines out of order in such a fashion that even a partially downloaded image was somewhat recognizable, also helped GIF's popularity,Fact|date=February 2007 as a user could abort the download if it was not what was required.
Pronunciation
The creators of the format pronounced GIF with a soft "
g ", IPA|/ˈdʒɪf/, as in "George". However, many people pronounce GIF with a hard "G", as in a 'gift' IPAEng|ˈɡɪf, reflecting the way it is pronounced in its own acronym (Graphics Interchange Format). [ [http://www.say-so.org/view/yn1evcqb Say-So: Gif of Jif? ] ] According to the creator of the GIF format,Steve Wilhite , the pronunciation deliberately echoes that of an American peanut butter brand, Jif, and the employees of CompuServe would often say "Choosy developers choose GIF", spoofing this brand's television commercials.Fact|date=April 2007 This pronunciation was also identified byCompuServe in their documentation of a graphics display program called CompuShow. [The FAQ section in the documentation for version 8.33 of CompuShow states: "The GIF (Graphics Interchange Format), pronounced "JIF", was designed byCompuServe and the official specification released in June of 1987." [http://www.olsenhome.com/gif/] ] . Both pronunciations are given as correct by theOxford English Dictionary [ cite web | url=http://dictionary.oed.com/cgi/entry/50292950?query_type=word&queryword=gif&first=1&max_to_show=10&sort_type=alpha&result_place=1&search_id=kUF6-h25mk9-6375&hilite=50292950
title=Oxford English Dictionary | publisher=Oxford University Press | accessdate=2007-04-15}] and theAmerican Heritage Dictionary . [cite web | url=http://dictionary.reference.com/browse/GIF | title=American Heritage Dictionary | publisher=Houghton-Mifflin | accessdate=2007-04-15]Usage
* GIFs are suitable for sharp-edged line art (such as logos) with a limited number of colors. This takes advantage of the format's lossless compression, which favors flat areas of uniform color with well defined edges (in contrast to
JPEG , which favors smooth gradients and softer images).
* GIFs can also be used to store low-color sprite data for games.
* GIFs can be used for small animations and low-resolution film clips.
* In view of the general limitation on the GIF image palette to 256 colors, it is not usually used as a format fordigital photography . Digital photographers use image file formats capable of reproducing a greater range of colors, such as TIFF, RAW or the lossyJPEG , which is more suitable for compressing photographs.
* The PNG format is a popular alternative to GIF images since it uses better compression techniques and does not have a limit of 256 colors, but PNGs do not support animations. The MNG and APNG formats, both derived from PNG, support animations, but aren't widely used.Palettes
GIF is palette based: although any palette selection can be one of millions of shades, the maximum number that can be used in a frame is 256. These are stored in a "palette", a table that associates each palette selection number with a specific
RGB value. The limitation to 256 colors seemed reasonable at the time of GIF's creation because few people could afford the hardware to display more. Simple graphics, line drawings, cartoons, and grey-scale photographs typically need fewer than 256 colors. In addition, one of the colors in the palette can optionally be set as fully transparent. A transparent pixel takes on the color of the pixel in the same positions from the background, which may have been determined by a previous frame of animation.There exist ways to dither or diffuse photographs by using pixels of 2 or more different colors to approximate an in-between color, but this transformation inevitably loses some detail. The
algorithm s used to select the palette and to perform the dithering vary widely in output quality. Additionally, dithering significantly reduces the image's compressibility and thus works contrary to GIF's main purpose.In the early days of graphical web browsers, graphics cards with 8-bit buffers (allowing only 256 colors) were common and it was fairly common to make GIF images using the websafe palette which was based on the common subset of the standard Windows and Macintosh palettes.Fact|date=February 2007 This ensured predictable display but severely limited the choice of colors. Now that 24-bit graphics cards are the norm, optimized palettes make less sense when creating images, though some web designers still advise the use of the web safe palette.Fact|date=February 2007
True color
There are at least two rarely-used methods [ [http://aminet.net/docs/misc/GIF24.readme GIF 24 Bit (truecolor) extensions] ] [ [http://www.peda.com/iag/layers.html Itsagif Layers] ] that can generate a GIF that, if decoded according to the GIF89a standard, will produce an animation that ends with a 24-bit RGB
truecolor image.GIF89a was designed based on the principle of rendering images (known as frames when used for animation) to a logical, fixed-size screen. Each image could optionally have no delay after it is rendered, and could have its own 256-color palette. Also, each image need not fill the entire logical screen, and the animation can cease after the last frame; it need not begin again. The multi-frame, zero-delay, and unique-palette features, optionally combined with transparency, allow for each image to replace only a "portion" of the previous image's pixel data. When used without looping, a more-than-256-color final result can be achieved.
For example, a GIF can be encoded to render as a series of overlapping full-screen images, each image filling in color that wasn't in the previous one. Transparent pixels can be used to preserve colors from previous images. [This method is demonstrated by Pedagoguery Software's [http://www.peda.com/iag/ Itsagif] software for Windows and older Macintosh OSes.]
A similar method that doesn't use transparency is to encode the GIF to render as a series of less-than-full-screen images adjacent to each other, rather than overlapping. [This method is explained in detail by Andreas Kleinert in his [http://uk.aminet.net/docs/misc/GIF24.readme GIF 24 Bit (truecolor) extensions] document, and is demonstrated on Philip Howard's [http://phil.ipal.org/tc.html True-Color GIF Example] Web page, which uses his "angif" C library. The demo uses blocks of size 16 by 16 pixels, allowing for up to 256 unique colors, 1 per pixel, the maximum each block's palette can support.]
These methods are not widely supported by GIF-generating software, and Web browsers and other image viewers may not contain completely compliant GIF89a implementations, so their ability to display such GIFs accurately may be limited.
Unisys and LZW patent enforcement
In 1977 and 1978,
Jacob Ziv andAbraham Lempel published a pair of papers on a new class of lossless data-compression algorithms, now collectively referred to as "LZ77 " and "LZ78 ". In 1983,Terry Welch developed a fast variant of LZ78 which was named LZW. [http://www.libpng.org/pub/png/pnghist.html History of the Portable Network Graphics (PNG) Format] by Greg Roelofs] [http://www.kyzer.me.uk/essays/giflzw/ Sad day... GIF patent dead at 20] ]Welch filed a patent application for the LZW method in June 1983. The resulting patent, Cite patent|US|4558302, granted in December 1985, was assigned to
Sperry Corporation who subsequently merged withBurroughs Corporation in 1986 and formedUnisys . Further patents were obtained in the United Kingdom, France, Germany, Italy, Japan and Canada.In June 1984, an article by Welch was published in the
IEEE magazine which publicly described the LZW technique for the first time. [http://www.cloanto.com/users/mcb/19950127giflzw.html The GIF Controversy: A Software Developer's Perspective] ] LZW became a popular data compression technique and, when the patent was granted, Unisys entered into licensing agreements with over a hundred companies. [http://lpf.ai.mit.edu/Patents/Gif/unisys.html Unisys Clarifies Policy Regarding Patent Use in On-Line Service Offerings] - archived byLeague for Programming Freedom ]The popularity of LZW led
CompuServe to choose it as the compression technique for their GIF format, developed in 1987. At the time, CompuServe were not aware of the patent. Unisys became aware that the GIF format used the LZW compression technique and entered into licensing negotiations with CompuServe in January 1993. The subsequent agreement was announced onDecember 24 ,1994 . Unisys stated that they expected all major commercial on-line information services companies employing the LZW patent to license the technology from Unisys at a reasonable rate, but that they would not require licensing, or fees to be paid, for non-commercial, non-profit GIF-based applications, including those for use on the on-line services.Following this announcement, there was widespread condemnation of CompuServe and Unisys, and many software developers threatened to stop using the GIF format. The PNG format was developed in 1995 as an intended replacement. However, obtaining support from the makers of Web browsers and other software for the PNG format proved difficult and it was not possible to replace the GIF format entirely, although PNG has gradually increased in popularity.
In August 1999, Unisys changed the details of their licensing practice, announcing the option for owners of Billboard and Intra net Web sites to obtain licenses on payment of a one-time license fee of $5000 or $7500. [http://www.unisys.com/about__unisys/lzw/lzw__license__english.htm LZW Software and Patent Information] - clarification of 2 September 1999] Such licenses were not required for website owners or other GIF users who had used licensed software to generate GIFs. Nevertheless, Unisys was the subject of thousands of online attacks and abusive emails from users believing that they were going to be charged $5000 or sued for using GIFs on their websites. [http://slashdot.org/articles/99/08/31/0143246.shtml Unisys Not Suing (most) Webmasters for Using GIFs] -
Slashdot investigation into the controversy] . Despite giving free licenses to hundreds of non-profit organizations, schools and governments, Unisys was completely unable to generate any good publicity and continued to be vilified by individuals and organizations such as theLeague for Programming Freedom who started the "Burn All GIFs" campaign [http://burnallgifs.org/archives/ Burn All GIFs] - A project of the League for Programming Freedom]The US LZW patent expired on
June 20 ,2003 . The counterpart patents in the United Kingdom, France, Germany and Italy expired onJune 18 ,2004 , the Japanese counterpart patents expired onJune 20 ,2004 and the counterpart Canadian patent expired onJuly 7 ,2004 . [http://www.unisys.com/about__unisys/lzw License Information on GIF and Other LZW-based Technologies] ] Consequently, while Unisys has further patents and patent applications relating to improvements to the LZW technique, the GIF format may now be used freely.Alternatives
Portable Network Graphics (PNG) was designed as a replacement for the GIF format in order to avoid infringement of Unisys' patent on the LZW compression technique. PNG offers better compression and more features than GIF. The format is more suitable than GIF in instances where true-color imaging,alpha transparency , or a lossless data format are required. MNG was originally developed as a PNG-based solution for animations, but has not been widely adopted. The GIF format is still preferred for animation over PNG, although trueAnimated Portable Network Graphics are under development byMozilla and is supported in Firefox 3. [http://wiki.mozilla.org/APNG_Specification APNG Specification - MozillaWiki ] ] [http://labs.mozilla.com/2007/08/better-animations-in-firefox-3/ Mozilla Labs » Blog Archive » Better animations in Firefox 3 ] ]Although it took time for the PNG format to be supported, new
web browser s support the PNG format and GIF images can usually be replaced by PNG images if desired. However,Internet Explorer versions 6 and earlier do not support PNG'salpha channel transparency feature without using Microsoft-specific HTML extensions. [ [http://msdn.microsoft.com/en-us/library/ms532969(VS.85).aspx AlphaImageLoader Filter] ] Using standard HTML <img> tags for PNG images in Internet Explorer can produce a look different from that intended. Internet Explorer 7 supports alpha channel transparency without needing extensions. No versions of Internet Explorer, however, support the gamma feature of PNG images, and the display of these images may be of the wrong tint. [http://msdn.microsoft.com/workshop/essentials/whatsnew/whatsnew_70_sdk.asp What's New in Internet Explorer 7]PNG image files are generally smaller than GIF files of the same image quality, due to the more efficient compression techniques used in PNG encoding. PNG files can indeed be much larger than GIF files in situations where a GIF and a PNG file were created from a high-quality master image, as PNG is capable of storing more color depth and transparency information than GIF. However, for identical 8-bit (or lower) image data, PNG-format image files are almost always smaller than the equivalent GIF. Misinformation about PNG efficiency can generally be traced back to poor PNG support in older versions of some image manipulation programs, (for example
Adobe Photoshop did not optimize PNGs for reduced color palettes by default).Fact|date=February 2007MNG, a variant of PNG that supports animation, reached version 1.0 in 2001, but few applications support it. Animated GIF remains widely used as many applications are capable of creating the files, and it remains the only animated image format capable of being rendered in nearly all modern web browsers without the use of a plug-in. [Adobe Photoshop CS2 for the Web (book)] Nevertheless, embedded Flash objects, MPEGs and other video formats are used in place of animated GIFs in many websites. Other approaches, such as individual frames served by
AJAX , orSVG images may be animated via JavaScript. In 2004, a proposed extension to the PNG format called APNG was suggested. It was to provide the ability to animate PNG files, while retaining backwards compatibility in decoders that cannot understand the animation chunk. Older decoders would simply render the first frame of the animation.See also
*
Comparison of graphics file formats
*Comparison of layout engines (graphics)
*Image file formats
*Software patent
*Lempel-Ziv-Welch References
External links
* [http://www.w3.org/Graphics/GIF/spec-gif89a.txt GIF89a specification]
* [http://www.olsenhome.com/gif/ The GIF Pronunciation Page]
* [http://members.aol.com/royalef/gifabout.htm GIF Animation on the WWW] - technical explanation of the GIF89a format and how it allows animation
* [http://www.arturocampos.com/ac_lzw_gif.html LZW GIF decoding] by Arturo San Emeterio Campos
* [http://www.cis.udel.edu/%7Eamer/CISC651/lzw.and.gif.explained.html LZW and GIF explained]
* [http://www.ddj.com/dept/architect/184404817 Replacing a Dictionary with a Square Root] - suggestions for compressing GIFs without using LZW compression
* [http://www.sph.sc.edu/comd/rorden/graphics.html Web Graphics] discusses and illustrates the differences between GIF, JPEG and PNG formats
Wikimedia Foundation. 2010.