1. TTfile
  2. GIF File
  3. What is GIF file?

What is GIF file?

GIF is a bitmap image format that was introduced by CompuServe in 1987 and has since come into widespread usage on the World Wide Web due to its wide support and portability. GIF images are compressed using the Lempel-Ziv-Welch (LZW) lossless data compression technique to reduce the file size without degrading the visual quality.

GIF files start with a fixed-length header ("GIF87a" or "GIF89a") giving the version, followed by a fixed-length Logical Screen Descriptor giving the size and other characteristics of the canvas. The screen descriptor may also specify the presence and size of a Global Color Table, which follows next if present.

Thereafter, the file is divided into segments, each introduced by a 1-byte sentinel:

  • An image (introduced by 0x2C, a comma ',')

  • An extension block (introduced by 0x21, an exclamation point '!')

  • The trailer (a single byte of value 0x3B, a semi-colon ';'), which should be the last byte of the file.

This structure allows the file to be parsed even if not all parts are understood. A GIF marked 87a may contain extension blocks; the intent is that a decoder can read and display the file without the features covered in extensions it doesn't understand.