Graphics Interchange Format - Example GIF File

Example GIF File

Microsoft's Paint program saves a small black and white image as the following GIF file. Paint does not make optimal use of the GIF format; due to the unnecessarily large color table (storing a full 256 colors instead of the used 2) and symbol width, this GIF file is not an efficient representation of the 15-pixel image (illustrated enlarged above).

Although the Graphics Control Extension block declares color index 16 (hexadecimal 10) to be transparent, that index is not used in the image. The only color indexes appearing in the image data are decimal 40 and 255, which the Global Color Table maps to black and white, respectively.

Note that the hex numbers in the following tables are in little-endian byte order, as the format specification prescribes.

byte# hexadecimal text or (hex) value Meaning 0: 47 49 46 38 39 61 GIF89a Header Logical Screen Descriptor 6: 03 00 3 - logical screen width in pixels 8: 05 00 5 - logical screen height in pixels A: F7 - GCT follows for 256 colors with resolution 3 x 8 bits/primary B: 00 0 - background color #0 C: 00 - default pixel aspect ratio R G B Global Color Table D: 00 00 00 0 0 0 - color #0 black 10: 80 00 00 128 0 0 - color #1 : : 85: 00 00 00 0 0 0 - color #40 black : : 30A: FF FF FF 255 255 255 - color #255 white 30D: 21 F9 Graphic Control Extension 30F: 04 4 - 4 bytes of GCE data follow 310: 01 - there is a transparent background color 311: 00 00 - delay for animation: not used 313: 10 16 - color #16 is transparent 314: 00 - end of GCE block 315: 2C Image Descriptor 316: 00 00 00 00 (0,0) - NW corner position of image in logical screen 31A: 03 00 05 00 (3,5) - image width and height in pixels 31E: 00 - no local color table 31F: 08 8 Start of image - LZW minimum code size 320: 0B 11 - 11 bytes of LZW encoded image data follow 321: 00 51 FC 1B 28 70 A0 C1 83 01 01 32C: 00 - end of image data 32D: 3B GIF file terminator

Read more about this topic:  Graphics Interchange Format

Famous quotes containing the word file:

    A common and natural result of an undue respect for law is, that you may see a file of soldiers, colonel, captain, corporal, privates, powder-monkeys, and all, marching in admirable order over hill and dale to the wars, against their wills, ay, against their common sense and consciences, which makes it very steep marching indeed, and produces a palpitation of the heart.
    Henry David Thoreau (1817–1862)