Professional Documents
Culture Documents
GIF Header
Offset
0
3
6
8
10
11
12
13
Length
3 bytes
3 bytes
2 bytes
2 bytes
1 byte
1
1
?
?
1
byte
byte
bytes
bytes
bytes
Contents
"GIF"
"87a" or "89a"
<Logical Screen Width>
<Logical Screen Height>
bit 0:
Global Color Table Flag (GCTF)
bit 1..3: Color Resolution
bit 4:
Sort Flag to Global Color Table
bit 5..7: Size of Global Color Table: 2^(1+n)
<Background Color Index>
<Pixel Aspect Ratio>
<Global Color Table(0..255 x 3 bytes) if GCTF is one>
<Blocks>
<Trailer> (0x3b)
Image Block
Offset
0
1
3
5
7
8
Length
1 byte
2 bytes
2 bytes
2 bytes
2 bytes
1 byte
? bytes
1 byte
[ // Blocks
1 byte
(s)bytes
]*
1 byte
Contents
Image Separator (0x2c)
Image Left Position
Image Top Position
Image Width
Image Height
bit 0:
Local Color Table Flag (LCTF)
bit 1:
Interlace Flag
bit 2:
Sort Flag
bit 2..3: Reserved
bit 4..7: Size of Local Color Table: 2^(1+n)
Local Color Table(0..255 x 3 bytes) if LCTF is one
LZW Minimum Code Size
Block Size (s)
Image Data
Block Terminator(0x00)
Length
1 byte
1 byte
1 byte
1 byte
Contents
Extension Introducer (0x21)
Graphic Control Label (0xf9)
Block Size (0x04)
bit 0..2: Reserved
4
6
7
2 bytes
1 byte
1 byte
Length
1 byte
1 byte
1 byte
(s)bytes
]*
1 byte
Contents
Extension Introducer (0x21)
Comment Label (0xfe)
Block Size (s)
Comment Data
Block Terminator(0x00)
Length
1 byte
1 byte
1 byte
2 bytes
2 bytes
2 bytes
2 bytes
1 byte
1 byte
1 byte
1 byte
1 byte
(s)bytes
1 byte
Contents
Extension Introducer (0x21)
Plain Text Label (0x01)
Block Size (0x0c)
Text Grid Left Position
Text Grid Top Position
Text Grid Width
Text Grid Height
Character Cell Width(
Character Cell Height
Text Foreground Color Index(
Text Background Color Index(
Block Size (s)
Plain Text Data
Block Terminator(0x00)
Length
1 byte
1 byte
1 byte
8 bytes
1 byte
(s)bytes
1 byte
GIF87a:
Contents
Extension Introducer (0x21)
Application Label (0xff)
Block Size (0x0b)
Application Identifire
Block Size (s)
Application Data
Block Terminator(0x00)
GIF Header
Image Block
Trailer
GIF89a:
GIF Header
Graphic Control Extension
Image Block
Trailer
GIF Animation
GIF Header
Application Extension
[
Graphic Control Extension
Image Block
]*
Trailer
size
description
size
description
12
parameter flags
16
20
24
28
32
36
40
44
48
52
size
description
10
14
18
20
22
24
size
description
10
14
18
22
26
28
30
34
38
42
46
50