GIF

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Animated GIF)
(Category:Animation)
 
(24 intermediate revisions by 7 users not shown)
Line 5: Line 5:
 
|mimetypes={{mimetype|image/gif}}
 
|mimetypes={{mimetype|image/gif}}
 
|locfdd={{LoCFDD|fdd000133}}
 
|locfdd={{LoCFDD|fdd000133}}
|pronom={{PRONOM|fmt/3}}<br>{{PRONOM|fmt/4}}
+
|pronom={{PRONOM|fmt/3}}, {{PRONOM|fmt/4}}
 
|uniform type={{UTI|com.compuserve.gif}}
 
|uniform type={{UTI|com.compuserve.gif}}
 +
|wikidata={{wikidata|Q2192}}
 +
|kaitai struct=gif
 
|released=1987
 
|released=1987
 
}}
 
}}
Line 63: Line 65:
 
[[Jeff's Image Format]] is a GIF-like format identified by '''JIF99a'''. The [[file command]]'s database suggests that GIF-like formats identified by '''GIF94z''' ("ZIF") and '''FGF95a''' ("FGF") were experimented with.
 
[[Jeff's Image Format]] is a GIF-like format identified by '''JIF99a'''. The [[file command]]'s database suggests that GIF-like formats identified by '''GIF94z''' ("ZIF") and '''FGF95a''' ("FGF") were experimented with.
  
== Color format ==
+
== Format details ==
 +
A GIF file consists of a header, followed by a sequence of tagged blocks of various types. The header consists of a signature, a ''screen descriptor'', and optionally a ''global color table''.
 +
 
 +
=== Color format ===
 
GIF images are always paletted. The number of colors in a palette can be any power of 2 from 2 to 256.
 
GIF images are always paletted. The number of colors in a palette can be any power of 2 from 2 to 256.
  
 
If a GIF file contains multiple images, each may have its own palette. This makes it possible for animated GIFs to construct frames that exceed the usual limit of 256 colors<ref>[http://phil.ipal.org/tc.html True-Color GIF Example]</ref>. This technique is inefficient, and may result in very large files.
 
If a GIF file contains multiple images, each may have its own palette. This makes it possible for animated GIFs to construct frames that exceed the usual limit of 256 colors<ref>[http://phil.ipal.org/tc.html True-Color GIF Example]</ref>. This technique is inefficient, and may result in very large files.
  
== Format ==
+
=== Extensions ===
A GIF file has a header (consisting of a signature, a ''screen descriptor'', and optionally a ''global color table''), followed by a sequence of tagged blocks of various types.
+
Block type 0x21 is an ''extension''. Each extension has a byte indicating its type.
 
+
Block type 0x21 is an ''extension''. Each extension has a byte indicating its type. GIF version 89a defines extension type 0xff to be an ''application extension'', which can be used to store arbitrary data.
+
 
+
An application extension's specific type is given by an application identifier consisting of exactly 8 ASCII characters, plus a three-byte "authentication code" to reduce the chance of a conflict. In effect, this means it has an 11-byte identifier.
+
  
=== Known application extensions ===
+
Type 0xff is an ''application extension'', which allows developers to define their own extensions. An application extension's specific type is given by an ''application identifier'' consisting of exactly 8 ASCII characters, plus a three-byte ''authentication code''. Some extensions combine these two IDs to make an 11-byte ID, while others use the authentication code for some other purpose.
  
* <code>"NETSCAPE" 0x32 0x2e 0x30 ("NETSCAPE2.0")</code>
+
Known extensions:
  
If the first byte of application data has value 0x01, this is a ''looping extension'' used in animated GIFs. It indicates the number of times to repeat the animation.
+
{| class="wikitable"
 +
! Type !! App ID & auth code !! Description
 +
|-
 +
|<code>0x01</code> || || Plain text [GIF89A]
 +
|-
 +
|<code>0xce</code>
 +
|
 +
|Frame name. Used by Gifsicle[https://www.lcdf.org/gifsicle/]. Seems to have the same format as a comment extension.
 +
|-
 +
|<code>0xf9</code> || || Graphic control [GIF89A]
 +
|-
 +
|<code>0xfe</code> || || Comment [GIF89A]
 +
|-
 +
|<code>0xff</code> || || Application extension [GIF89A]
 +
|-
 +
|<code>0xff</code>
 +
|<code>"NETSCAPE2.0"</code>
 +
|If the first byte of application data has value 0x01, this is a ''looping extension'' used in animated GIFs. It indicates the number of times to repeat the animation.
  
 
If the first byte is not 0x01, the extension is probably of no interest, but apparently at least one such extension was defined (0x02 = Netscape Buffering Extension<ref>[http://www.vurdalakov.net/misc/gif/netscape-buffering-application-extension Netscape Buffering Application Extension]</ref>).
 
If the first byte is not 0x01, the extension is probably of no interest, but apparently at least one such extension was defined (0x02 = Netscape Buffering Extension<ref>[http://www.vurdalakov.net/misc/gif/netscape-buffering-application-extension Netscape Buffering Application Extension]</ref>).
 
+
|-
* <code>"ANIMEXTS" 0x31 0x2e 0x30 ("ANIMEXTS1.0")</code>
+
|<code>0xff</code>
 
+
|<code>"ANIMEXTS1.0"</code>
Same as "NETSCAPE2.0" looping extension.
+
|Same as "NETSCAPE2.0" looping extension (?).
 
+
|-
* <code>"ICCRGBG1" 0x30 0x31 0x32 ("ICCRGBG1012")</code>
+
|<code>0xff</code>
 
+
|<code>"ICCRGBG1012"</code>
Stores an [[ICC profile]].
+
|Stores an [[ICC profile]].
 
+
|-
* <code>"XMP Data" 0x58 0x4d 0x50 ("XMP DataXMP")</code>
+
|<code>0xff</code>
 
+
|<code>"XMP DataXMP"</code>
Stores [[XMP]] metadata.
+
|Stores [[XMP]] metadata.
 
+
|-
* <code>"fractint" ?? ?? ??</code>
+
|<code>0xff</code>
 
+
|<code>"ImageMagick"</code>, <code>"MGK8BIM0000"</code>, <code>"MGKIPTC0000"</code>
Used by the DOS program Fractint to save additional data (fractal parameters). The only documentation about this may be the source code<ref>[http://fractint.net/fractsvn/trunk/fractint/common/encoder.c Fractint source code: encoder.c]</ref>. See also [[FRA (Fractint)|FRA]].
+
|Used by [[ImageMagick]].
 
+
|-
* <code>"MathType" ?? ?? ??</code>
+
|<code>0xff</code>
 
+
|<code>"fractint"</code>
Used by MathType<ref>[http://www.inr.ac.ru/~blackbox/MathType/SDK/docs/baseline_gif.htm MathType 5 SDK: Extracting Baseline Info from a GIF File]</ref>.
+
|Used by the DOS program Fractint to save additional data (fractal parameters). The only documentation about this may be the source code<ref>[http://fractint.net/fractsvn/trunk/fractint/common/encoder.c Fractint source code: encoder.c]</ref>. See also [[FRA (Fractint)|FRA]].
 +
|-
 +
|<code>0xff</code>
 +
|<code>"MathType"</code>
 +
|Used by MathType.<ref>[http://www.inr.ac.ru/~blackbox/MathType/SDK/docs/baseline_gif.htm MathType 5 SDK: Extracting Baseline Info from a GIF File]</ref>
 +
|-
 +
|<code>0xff</code>
 +
|<code>"MIDICTRL"</code>, <code>"MIDISONG"</code>, <code>"PCM-CTRL"</code>, <code>"PCM-FRMT"</code>, <code>"PCM-DATA"</code>
 +
|MMGIF Multimedia Extensions.<ref>[http://www.midiox.com/mmgif.htm MMGIF website], [http://www.midiox.com/txt/mmginf.txt extensions spec.]</ref>
 +
|-
 +
|<code>0xff</code>
 +
|<code>"GIFLITE&nbsp;&nbsp;&nbsp;&nbsp;"</code>
 +
|GIFLITE[https://archive.org/details/msdos_festival_GIFLT210] header
 +
|-
 +
|<code>0xff</code>
 +
|<code>"PIANYGIF"</code>
 +
|Apparently associated with Ulead GIF Animator.
 +
|}
  
 
== Identification ==
 
== Identification ==
 
GIF files begin with ASCII characters "<code>GIF87a</code>" (version 87a), or "<code>GIF89a</code>" (version 89a).
 
GIF files begin with ASCII characters "<code>GIF87a</code>" (version 87a), or "<code>GIF89a</code>" (version 89a).
 +
 +
== Related formats ==
 +
* [[CompuServe RLE]] - predecessor
 +
* [[FRA (Fractint)]]
 +
* [[GIFBLAST]]
 +
* [[GIFEXE]]
 +
* [[Gifpress]]
 +
* [[Gifshuffle]]
 +
* [[GIFV]]
 +
* [[Jeff's Image Format]]
 +
* [[LZW]]
 +
* [[MAG (GIF archiver)]]
 +
* [[NETPIC (Jim Tucker)]]
 +
* [[Title-Maker]]
  
 
== Specifications ==
 
== Specifications ==
Line 119: Line 168:
 
* [http://odur.let.rug.nl/~kleiweg/gif/netscape.html GIF Application Extension: NETSCAPE2.0] ([http://web.archive.org/web/20130317195536/http://odur.let.rug.nl/~kleiweg/gif/netscape.html alternate link] from archive.org)
 
* [http://odur.let.rug.nl/~kleiweg/gif/netscape.html GIF Application Extension: NETSCAPE2.0] ([http://web.archive.org/web/20130317195536/http://odur.let.rug.nl/~kleiweg/gif/netscape.html alternate link] from archive.org)
  
== Metaformat files ==
+
== Sample files ==
 +
* [http://gifcities.org/ GifCities: GeoCities animated GIF archive]
 +
* http://whatis.rest7.com/how-to-open-gif-file
 +
* {{DexvertSamples|image/gif}}
  
* [https://www.synalysis.net/Grammars/gif.grammar Synalysis grammar file] (for Hexinator / Synalize It!; [[Synalysis grammar file|more details]])
+
== Metaformat files ==
 +
* {{Synalysis|gif}}
  
 
== Software ==
 
== Software ==
Line 133: Line 186:
 
* [http://coptr.digipres.org/Bad_Peggy Bad Peggy: scans images for problems]
 
* [http://coptr.digipres.org/Bad_Peggy Bad Peggy: scans images for problems]
 
* [http://mirrors.apple2.org.za/ftp.apple.asimov.net/images/productivity/graphics/misc/Apple%20II%20Gif%20Viewer.shk Apple II GIF viewer] ([http://mirrors.apple2.org.za/ftp.apple.asimov.net/images/productivity/graphics/misc/Apple%20II%20Gif%20Viewer.TXT Documentation])
 
* [http://mirrors.apple2.org.za/ftp.apple.asimov.net/images/productivity/graphics/misc/Apple%20II%20Gif%20Viewer.shk Apple II GIF viewer] ([http://mirrors.apple2.org.za/ftp.apple.asimov.net/images/productivity/graphics/misc/Apple%20II%20Gif%20Viewer.TXT Documentation])
 +
* [[XnView]]
 +
* [[Tom's Editor]]
 +
* [https://ezgif.com/maker Online animated GIF maker]
 +
* {{CdTextfiles|simtel/stmsdos9709/disk1/DISC1/GRAPHICS/2SHOW204.ZIP|CompuShow 2000! v2.04a}} - DOS program, descendant of one of the first GIF viewers
 +
* {{Reggae}}
  
 
== File conversions ==
 
== File conversions ==
 
* [http://gfycat.com/ gfycat: Convert GIFs to HTML 5 video]
 
* [http://gfycat.com/ gfycat: Convert GIFs to HTML 5 video]
 
* [http://www.kickstarter.com/projects/sha/gifpop-custom-gif-cards-for-everyone Custom lenticular-printed cards from animated GIFs]
 
* [http://www.kickstarter.com/projects/sha/gifpop-custom-gif-cards-for-everyone Custom lenticular-printed cards from animated GIFs]
 
== References ==
 
<references/>
 
  
 
== External links ==
 
== External links ==
Line 164: Line 219:
 
* [http://www.digitalpreservation.gov/formats/fdd/fdd000133.shtml Library of Congress Digital Preservation page on GIF]
 
* [http://www.digitalpreservation.gov/formats/fdd/fdd000133.shtml Library of Congress Digital Preservation page on GIF]
 
* [http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html High quality GIF with FFmpeg]
 
* [http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html High quality GIF with FFmpeg]
* [http://gifcities.org/ GifCities: GeoCities animated GIF archive]
+
* [http://theknow.denverpost.com/2017/05/11/gif-exhibit-boulder-museum-of-contemporary-art-ello-2017/143862/ Are GIFs fine art? Ello and the Boulder Museum of Contemporary Art think so]
 +
* [https://github.com/corkami/pics/blob/master/binary/GIF.png Graphic documenting format]
 +
 
 +
== References ==
 +
<references/>
  
[[Category:Video]]
+
[[Category:Animation]]
 +
[[Category:Netscape]]

Latest revision as of 19:05, 23 April 2024

File Format
Name GIF
Ontology
Extension(s) .gif
MIME Type(s) image/gif
LoCFDD fdd000133
PRONOM fmt/3, fmt/4
UTI com.compuserve.gif
Wikidata ID Q2192
Kaitai Struct Spec gif.ksy
Released 1987

Graphics Interchange Format (GIF) was introduced by the CompuServe online service in 1987, intended to provide a consistent and compact format for graphics to be downloaded on that service. Since the specifications were openly released, the format gained wide use in graphics software and on online services and bulletin board systems (BBSs), not just CompuServe; later it became a major Web graphic format. GIF's ability to have animation (unlike most still graphic formats) has caused it to gain some Internet notoriety and use in conjunction with "memes".

Contents

[edit] Patents

In 1994, it became widely known that the format was encumbered by the use of the patent-protected LZW compression technology, for which its owner, Unisys, was demanding licencing terms and royalties for certain sorts of uses. This made GIF a less-than-free format, spurring a desire on the part of some people for an unencumbered format, which led to the creation of the PNG format. However, it took several years for PNG to get widespread support in software, and in the meantime the World Wide Web experienced meteoric growth with GIF still used as the primary graphics format (alongside JPEG), though eventually PNG did become widespread on the Web as well. The patent in question expired in the US in 2003, and in other countries in 2004, so it is no longer an issue.

Another attempt at a patent-free format to replace GIF, Jeff's Image Format (JIF), never caught on.

[edit] Pronunciation

There is much debate over whether to pronounce "GIF" with a hard or a soft G. The creators of the format at CompuServe pronounced GIF as "jif" with a soft "G" /ˈdʒɪf/ as in "gin". Steve Wilhite, the engineering lead at CompuServe, said that the intended pronunciation deliberately echoes the American peanut butter brand, Jif, and CompuServe employees would often say "Choosy developers choose GIF", spoofing this brand's television commercials.[1] In addition, a sample GIF that was bundled with software released by CompuServe in 1989 contains metadata that includes the following line: "Oh, incidentally, it's pronounced 'JIF'". The original image and metadata can be viewed on a Unix-like operating system with the following command:

   $ curl http://www.olsenhome.com/gif/BOB_89A.GIF | strings | grep JIF
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100 37062  100 37062    0     0   158k      0 --:--:-- --:--:-- --:--:--  196k
   |s,Oh, incidentally, it'spronounced "JIF"

Both pronunciations are acceptable to the Oxford American Dictionaries, which named it the word of the year[2] in 2012, in its supposed usage as a verb (which they don't seem to actually use in a sentence anywhere in their announcement).

Some hard-G proponents say that the hard "g" is proper due to it standing for "graphics", which has a hard "g", but others cite the normal English pattern of pronouncing "g" soft when followed by an "i" (though, like most English spelling and pronunciation rules, it has exceptions like "gift").

In 2013, Wilhite again reaffirmed the soft-G pronunciation[3], but there are some that still refuse to accept it[4].

[edit] Animated GIF

Unlike most other graphic formats, GIF supports multiple-frame animated graphics in addition to single-image graphics. These animated GIFs are often used on web pages, sometimes for good reasons, sometimes as a poor man's video format, and all too often (especially during the early wave of Web popularity) to animate clip art and other images that would be better left motionless. In the 2010s, the use of animated GIFs for spreading Internet memes had a sudden and intense burst of popularity, and could sometimes be used in a very artistic manner.

The GIF features used for animation seem to have been intended for slideshows, and not for the type of animation they came to be used for. In fact, the specification clearly states that "[GIF] is not intended as a platform for animation." The only missing element – a loop count – was supplied by Netscape's looping extension (see below).

In the popular vernacular these days, "GIF" seems synonymous with "animated GIF", even though the format has a long history of use in static (non-animated) graphics. Much (though not all) use of static GIFs has shifted to PNG and other formats, leaving GIF in the niche of animated graphics.

In response to the popularity of animated GIFs, as well as the fact that this is actually not a very efficient format for storage and transmission of animations (each frame must be included as a complete image, without the economies of compression used in animation formats that store only the changes between one frame and the next), some social-networking and image-hosting services have begun converting animated GIFs uploaded by users to other formats for display. For instance, Imgur uses its own GIFV format, which is actually an MP4 video encapsulated as an element in an HTML 5 document, which is served with a .gifv extension. The result is that popular use of the term "GIF" now often refers to things that are not actually in that format; it seems to have taken on the meaning of "brief, small, silent animated sequence usually found on web pages or in social media feeds", without regard to their actual file format, so you have the peculiar situation where a static graphic in GIF format is not a "GIF" but a short, silent MP4 video is one. Language evolution is peculiar.

A GIF can, apparently, also be a deadly weapon.

[edit] Versions

[edit] Version 87a

The original version, released 1987-06-15. As a reference point, it supports:

  • Multiple images in a single file
  • Interlaced images
  • Background colors
  • Extensions, but each extension would have to be approved by CompuServe in order to avoid conflicts

[edit] Version 89a

Released 1990-07-31. Adds support for:

  • Binary transparency
  • Animation, though there is no way to indicate whether the animation should loop
  • Application extensions that don't require central coordination
  • Comment extensions
  • Plain Text extensions (an obsolete feature)

[edit] Other versions

There are no other official GIF version numbers.

Jeff's Image Format is a GIF-like format identified by JIF99a. The file command's database suggests that GIF-like formats identified by GIF94z ("ZIF") and FGF95a ("FGF") were experimented with.

[edit] Format details

A GIF file consists of a header, followed by a sequence of tagged blocks of various types. The header consists of a signature, a screen descriptor, and optionally a global color table.

[edit] Color format

GIF images are always paletted. The number of colors in a palette can be any power of 2 from 2 to 256.

If a GIF file contains multiple images, each may have its own palette. This makes it possible for animated GIFs to construct frames that exceed the usual limit of 256 colors[5]. This technique is inefficient, and may result in very large files.

[edit] Extensions

Block type 0x21 is an extension. Each extension has a byte indicating its type.

Type 0xff is an application extension, which allows developers to define their own extensions. An application extension's specific type is given by an application identifier consisting of exactly 8 ASCII characters, plus a three-byte authentication code. Some extensions combine these two IDs to make an 11-byte ID, while others use the authentication code for some other purpose.

Known extensions:

Type App ID & auth code Description
0x01 Plain text [GIF89A]
0xce Frame name. Used by Gifsicle[1]. Seems to have the same format as a comment extension.
0xf9 Graphic control [GIF89A]
0xfe Comment [GIF89A]
0xff Application extension [GIF89A]
0xff "NETSCAPE2.0" If the first byte of application data has value 0x01, this is a looping extension used in animated GIFs. It indicates the number of times to repeat the animation.

If the first byte is not 0x01, the extension is probably of no interest, but apparently at least one such extension was defined (0x02 = Netscape Buffering Extension[6]).

0xff "ANIMEXTS1.0" Same as "NETSCAPE2.0" looping extension (?).
0xff "ICCRGBG1012" Stores an ICC profile.
0xff "XMP DataXMP" Stores XMP metadata.
0xff "ImageMagick", "MGK8BIM0000", "MGKIPTC0000" Used by ImageMagick.
0xff "fractint" Used by the DOS program Fractint to save additional data (fractal parameters). The only documentation about this may be the source code[7]. See also FRA.
0xff "MathType" Used by MathType.[8]
0xff "MIDICTRL", "MIDISONG", "PCM-CTRL", "PCM-FRMT", "PCM-DATA" MMGIF Multimedia Extensions.[9]
0xff "GIFLITE    " GIFLITE[2] header
0xff "PIANYGIF" Apparently associated with Ulead GIF Animator.

[edit] Identification

GIF files begin with ASCII characters "GIF87a" (version 87a), or "GIF89a" (version 89a).

[edit] Related formats

[edit] Specifications

[edit] Sample files

[edit] Metaformat files

[edit] Software

Support for GIF is ubiquitous. The software listed here has been arbitrarily selected.

[edit] File conversions

[edit] External links

[edit] References

  1. http://www.olsenhome.com/gif/ GIF Pronunciation Page
  2. GIF (as a verb) is dictionary’s word of the year
  3. Even GIF Creator Can't Settle The Debate On The Pronunciation Of 'GIF'
  4. http://gizmodo.com/the-creator-of-the-gif-says-its-pronounced-jif-he-is-509179289 Creator of GIF is wrong
  5. True-Color GIF Example
  6. Netscape Buffering Application Extension
  7. Fractint source code: encoder.c
  8. MathType 5 SDK: Extracting Baseline Info from a GIF File
  9. MMGIF website, extensions spec.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox