Screen Descriptor
The Screen Descriptor describes the overall parameters for all GIF images
following. It defines the overall dimensions of the image space or
logical screen required, the existance of colour mapping information,
background screen colour, and colour depth information. This information
is stored in a series of 8-bit bytes as described below.
bits
7 6 5 4 3 2 1 0 Byte #
┌───────────────┐
│ │ 1
├ Screen Width ┤ Raster width in pixels (LSB first)
│ │ 2
├───────────────┤
│ │ 3
├ Screen Height ┤ Raster height in pixels (LSB first)
│ │ 4
├─┬─────┬─┬─────┤ M = 1, Global colour map follows Descriptor
│M│ cr │0│pixel│ 5 cr+1 = # bits of colour resolution
├─┴─────┴─┴─────┤ pixel+1 = # bits/pixel in image
│ background │ 6 background=colour index of screen background
├───────────────┤ (colour is defined from the Global colour
│0 0 0 0 0 0 0 0│ 7 map or default map if none specified)
└───────────────┛
The logical screen width and height can both be larger than the
physical display. How images larger than the physical display are
handled is implementation dependent and can take advantage of hardware
characteristics (e.g. Macintosh scrolling windows). Otherwise images
can be clipped to the edges of the display.
The value of 'pixel' also defines the maximum number of colours within
an image. The range of values for 'pixel' is 0 to 7 which
represents 1 to 8 bits. This translates to a range of 2 (B & W) to 256
colours. Bit 3 of word 5 is reserved for future definition and must be
zero.