Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
GIF
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Animated GIF== [[File:Newtons cradle animation book 2.gif|thumb|left|GIF can be used to display animation, as in this image of [[Newton's cradle]].]] Although GIF was not designed as an animation medium, its ability to store multiple images in one file naturally suggested using the format to store the [[Film frame|frames]] of an animation sequence. To facilitate ''displaying'' animations, the GIF89a spec added the Graphic Control Extension (GCE), which allows the images (frames) in the file to be painted with time delays, forming a [[digital video|video clip]]. Each frame in an animation GIF is introduced by its own GCE specifying the time delay to wait after the frame is drawn. Global information at the start of the file applies by default to all frames. The data is stream-oriented, so the file offset of the start of each GCE depends on the length of preceding data. Within each frame the LZW-coded image data is arranged in sub-blocks of up to 255 bytes; the size of each sub-block is declared by the byte that precedes it. By default, an animation displays the sequence of frames only once, stopping when the last frame is displayed. To enable an animation to loop, [[Netscape]] in the 1990s used the Application Extension block (intended to allow vendors to add application-specific information to the GIF file) to implement the Netscape Application Block (NAB).<ref>{{cite web |url=http://www6.uniovi.es/gifanim/gifabout.htm |title=All About GIF89a |author=Royal Frazier |access-date=7 January 2013 |archive-url=https://web.archive.org/web/19990418091037/http://www6.uniovi.es/gifanim/gifabout.htm |archive-date=18 April 1999 |url-status=dead }}</ref> This block, placed immediately before the sequence of animation frames, specifies the number of times the sequence of frames should be played (1 to 65535 times) or that it should repeat continuously (zero indicates loop forever). Support for these repeating animations first appeared in [[Netscape Navigator]] version 2.0, and then spread to other browsers.<ref> {{cite book |isbn=0-7897-0947-3 |title=Web Scripting Secret Weapons |author=Scott Walter |publisher=[[Que Publishing]] |year=1996 }}</ref> Most browsers now recognize and support NAB, though it is not strictly part of the GIF89a specification. The following example shows the structure of the animation file ''[[:File:Rotating earth (large).gif|Rotating earth (large).gif]]'' shown (as a thumbnail) in the article's infobox.<!-- Given for the last file version (27 August 2019) --> {| class="wikitable" |+ Structure of GIF ! Byte # (hex) !! Hexadecimal || Text or value || Meaning |- | 0 || 47 49 46 38 39 61 || GIF89a || Logical Screen Descriptor |- | 6 || 90 01 || 400 || Width in pixels |- | 8 || 90 01 || 400 || Height in pixels |- | A || F7 || || GCT follows for 256 colors with resolution 3{{resx}}8 bits/primary |- | B || 00 || 0 || Background color: #000000, black |- | C || 00 || 0 || Default pixel aspect ratio, 0:0 |- | D || 00 || || Global Color Table |- | โฎ || || || |- |30D |21 |<code>'!'</code> |An Extension Block (introduced by an ASCII exclamation point <code>'!'</code>) |- | 30E || FF || || Application Extension |- | 30F || 0B || 11 || Size of block including application name and verification bytes (always 11) |- | 310 || 4E 45 54 53 43 41 50 45 32 2E 30 || NETSCAPE2.0 || 8-byte application name plus 3 verification bytes |- | 31B || 03 || 3 || Number of bytes in the following sub-block |- | 31C || 01 || 1 || Index of the current data sub-block ''(always 1 for the NETSCAPE block)'' |- | 31D || FF FF || 65535 || [[Unsigned number]] of repetitions |- | 31F || 00 || || End of the sub-block chain for the Application Extension block |- |320 |21 |<code>'!'</code> |An Extension Block (introduced by an ASCII exclamation point <code>'!'</code>) |- | 321 || F9 || || Graphic Control Extension for frame #1 |- | 322 || 04 || 4 || Number of bytes (4) in the current sub-block |- | 323 || 04 || <syntaxhighlight lang="text"> 000..... ...001.. ......0. .......0 </syntaxhighlight> ''(broken into sections for easier reading)'' || Reserved, 5 lower bits are [[bit field]]<br/>Disposal method 1: do not dispose<br/>No user input<br/>Transparent color, 0 means not given |- | 324 || 09 00 || 9 || Frame delay: 0.09 second delay before painting next frame |- | 326 || FF || || Transparent color index ''(unused in this frame)'' |- | 327 || 00 || || End of sub-block chain for Graphic Control Extension block |- | 328 || 2C || <code>','</code>|| An Image Descriptor (introduced by 0x2C, an ASCII comma <code>','</code>) |- | 329 || 00 00 00 00 || (0, 0) || North-west corner position of image in logical screen: (0, 0) |- | 32D || 90 01 90 01 || (400, 400) || Frame width and height: 400{{resx}}400 pixels |- | 331 || 00 || 0 || Local color table: 0 means none & no interlacing |- | 332 || 08 || 8 || Minimum LZW code size for Image Data of frame #1 |- | 333 || FF || 255 || Number of bytes of LZW image data in the following sub-block: 255 bytes |- | 334 || ... || <image data> || Image data, 255 bytes |- | 433 || FF || 255 || Number of bytes of LZW image data in the following sub-block, 255 bytes |- | 434 || ... || <image data> || Image data, 255 bytes |- | โฎ || || || Repeat for next blocks |- | 92C0 || 00 || || End of sub-block chain for this frame |- |92C1 |21 |<code>'!'</code> |An Extension Block (introduced by an ASCII exclamation point <code>'!'</code>) |- | 92C2 || F9 || || Graphic Control Extension for frame #2 |- | โฎ || || || Repeat for next frames |- |EDABD |21 |<code>'!'</code> |An Extension Block (introduced by an ASCII exclamation point <code>'!'</code>) |- | EDABE || F9 || || Graphic Control Extension for frame #44 |- | โฎ || || || Image information and data for frame #44 |- | F48F5 || 3B || || Trailer: Last byte in the file, signaling EOF |} The animation delay for each frame is specified in the GCE in hundredths of a second. Some economy of data is possible where a frame need only rewrite a portion of the pixels of the display, because the Image Descriptor can define a smaller rectangle to be rescanned instead of the whole image. Browsers or other displays that do not support animated GIFs typically show only the first frame. The size and color quality of animated GIF files can vary significantly depending on the application used to create them. Strategies for minimizing file size include using a common global color table for all frames (rather than a complete local color table for each frame) and minimizing the number of pixels covered in successive frames (so that only the pixels that change from one frame to the next are included in the latter frame). More advanced techniques involve modifying color sequences to better match the existing LZW dictionary, a form of [[lossy compression]]. Simply packing a series of independent frame images into a composite animation tends to yield large file sizes. Tools are available to minimize the file size given an existing GIF.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
GIF
(section)
Add topic