Raster Data

The format of the actual image is defined as the series of pixel color values that make up the image. The pixels are stored sequentially left to right for an image row. Normally, 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, 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 row 0. The second pass writes every 8th row   starting at row 4. The third pass writes every 4th row starting at row 2. The fourth pass completes the image, writing every other row, starting at row 1. A graphic description of this process follows:

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 pixel values are stored as a series of color indices which map into the existing color map. The resulting color value is what is actually displayed. This series of pixel indices, the number of which is equal to image-width*image-height pixels, are passed in the GIF image data stream one byte per pixel, and compressed according to the LZW compression algorithm.