Skip to content

Instantly share code, notes, and snippets.

@retorillo
Last active July 14, 2017 10:27
Show Gist options
  • Save retorillo/1bb238023ecc29eed6cef636db930ba0 to your computer and use it in GitHub Desktop.
Save retorillo/1bb238023ecc29eed6cef636db930ba0 to your computer and use it in GitHub Desktop.
GIF and LZW References

LZW References

LZW data compression algorithm (US PAT.)

Compression of Individual Sequences via Variable Rate Coding (IEEE)

A Technique For High-Performance Data Compression (IEEE)

LZW Data Compression

The LZW algorithm (Data Compression Reference Center)

GIF Specification (W3C)

@retorillo
Copy link
Author

Animated-GIF Looping extension (unofficial)

http://www.vurdalakov.net/misc/gif/netscape-looping-application-extension

Syntax

    +---------------+
 0  |     0x21      |  Extension Label
    +---------------+
 1  |     0xFF      |  Application Extension Label
    +---------------+
 2  |     0x0B      |  Block Size
    +---------------+
 3  |               | 
    +-             -+
 4  |               | 
    +-             -+
 5  |               | 
    +-             -+
 6  |               | 
    +-  NETSCAPE   -+  Application Identifier (8 bytes)
 7  |               | 
    +-             -+
 8  |               | 
    +-             -+
 9  |               | 
    +-             -+
10  |               | 
    +---------------+
11  |               | 
    +-             -+
12  |      2.0      |  Application Authentication Code (3 bytes)
    +-             -+
13  |               | 
    +===============+                      --+
14  |     0x03      |  Sub-block Data Size   |
    +---------------+                        |
15  |     0x01      |  Sub-block ID          |
    +---------------+                        | Application Data Sub-block
16  |               |                        |
    +-             -+  Loop Count (2 bytes)  |
17  |               |                        |
    +===============+                      --+
18  |     0x00      |  Block Terminator
    +---------------+
  • Extension Label - Defines this block as an extension. This field contains the fixed value 0x21 (33).
  • Application Extension Label - Identifies the block as an Application Extension. This field contains the fixed value 0xFF (255).
  • Block Size - Number of bytes in this extension block, following the Block Size field, up to but not including the beginning of the Application Data. This field contains the fixed value 0x0B (11).
  • Application Identifier - Sequence of eight printable ASCII characters used to identify the application owning the Application Extension. This field contains the fixed value "NETSCAPE".
  • Application Authentication Code - Sequence of three bytes used to authenticate the Application Identifier. An Application program may use an algorithm to compute a binary code that uniquely identifies it as the application owning the Application Extension. This field contains the fixed value "2.0". Sometimes Application Identifier and Application Authentication Code fields are referred as one "NETSCAPE2.0" field.
  • Sub-block Data Size - Indicates the number of data bytes to follow. The size of the block does not account for the size byte itself. This field contains the fixed value 0x03 (3).
  • Sub-block ID - Identifies the Netscape Looping Extension. This field contains the fixed value 0x01 (1).
  • Loop Count - Indicates the number of iterations the animated GIF should be executed. This field is an unsigned 2-byte integer in little-endian (least significant byte first) byte order. 0x00 (0) means infinite loop.
  • Block Terminator - This zero-length data block marks the end of the Application Extension. This field contains the fixed value 0x00 (0).

@retorillo
Copy link
Author

Netscape Buffering Application Extension (GIF Unofficial Specification)

    +---------------+
 0  |     0x21      |  Extension Label
    +---------------+
 1  |     0xFF      |  Application Extension Label
    +---------------+
 2  |     0x0B      |  Block Size
    +---------------+
 3  |               | 
    +-             -+
 4  |               | 
    +-             -+
 5  |               | 
    +-             -+
 6  |               | 
    +-  NETSCAPE   -+  Application Identifier (8 bytes)
 7  |               | 
    +-             -+
 8  |               | 
    +-             -+
 9  |               | 
    +-             -+
10  |               | 
    +---------------+
11  |               | 
    +-             -+
12  |      2.0      |  Application Authentication Code (3 bytes)
    +-             -+
13  |               | 
    +===============+                      --+
14  |     0x05      |  Sub-block Data Size   |
    +---------------+                        |
15  |     0x02      |  Sub-block ID          |
    +---------------+                        |
16  |               |                        |
    +-             -+                        | Application Data Sub-block
17  |               |                        |
    +-             -+  Buffer Size (4 bytes) |
18  |               |                        |
    +-             -+                        |
19  |               |                        |
    +===============+                      --+
20  |     0x00      |  Block Terminator
    +---------------+

http://www.vurdalakov.net/misc/gif/netscape-buffering-application-extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment