Raster Data

The format of the actual image is defined as the series of pixel colour
index values that make up the image. The pixels are stored left to right
sequentially for an image row. By default each image row is written
sequentially, top to bottom. In the case that the Interlace or 'I' bit is
set in byte 10 of the Image Descriptor then the row order of the image
display follows a four-pass process in which the image is filled in by
widely spaced rows. The first pass writes every 8th row, starting with
the top row of the image window. The second pass writes every 8th row
starting at the fifth row from the top. The third pass writes every
4th row starting at the third row from the top. The fourth pass completes
the image, writing every other row, starting at the second row from
the top. A graphic description of this process follows:


Image
Row Pass 1 Pass 2 Pass 3 Pass 4 Result
─────────────────────────────────────────────────────
0 **1a** **1a**
1 **4a** **4a**
2 **3a** **3a**
3 **4b** **4b**
4 **2a** **2a**
5 **4c** **4c**
6 **3b** **3b**
7 **4d** **4d**
8 **1b** **1b**
9 **4e** **4e**
10 **3c** **3c**
11 **4f** **4f**
12 **2b** **2b**
. . .



The image pixel values are processed as a series of colour indices which
map into the existing colour map. The resulting colour value from the map
is what is actually displayed. This series of pixel indices, the
number of which is equal to image-width*image-height pixels, are passed
to the GIF image data stream one value per pixel, compressed and packaged
according to a version of the LZW compression algorithm as defined in
a later entry.