Interlaced GIF First Pass: Rows Explained

This article explains how the interlacing process works in the Graphics Interchange Format (GIF) standard, identifying precisely which image rows are rendered during the initial pass. It details the four-pass interlacing scheme defined in the GIF specifications, the mathematical sequence of rows read during the first pass, and the visual purpose behind this encoding technique.

In an interlaced GIF file, the first pass renders every 8th row, starting at row 0. Using standard zero-based row numbering (where the topmost row of the image is row 0), the rows rendered in the first pass are:

If counting with a one-based indexing system (where the top row is row 1), the first pass renders row 1 and every 8th row thereafter (rows 1, 9, 17, 25, 33, etc.).

Interlacing in GIF files is designed to display a recognizable, low-resolution preview of an image while the complete data stream downloads. To achieve this, the format divides the horizontal raster lines into four distinct passes:

  1. Pass 1: Starts at row 0, reading every 8th row (rows 0, 8, 16, 24, ...).
  2. Pass 2: Starts at row 4, reading every 8th row (rows 4, 12, 20, 28, ...).
  3. Pass 3: Starts at row 2, reading every 4th row (rows 2, 6, 10, 14, ...).
  4. Pass 4: Starts at row 1, reading every 2nd row (rows 1, 3, 5, 7, ...).

During playback or downloading, software displays the first pass by filling the empty space between the rendered lines—often by replicating row 0 downward across rows 1 through 7, row 8 across rows 9 through 15, and so forth. This provides an immediate, albeit pixelated, structural layout of the entire image using only one-eighth of the total line data.