Interlaced bitmaps are bitmaps where the rows of pixels (“scanlines”) are stored out of sequence.
For example, the odd numbered scanlines might be stored first, and even numbered scanlines might be stored later.
Some Bitmap File Formats allow interlacing, but others do not. When a bitmap file is interlaced, it potentially allows the bitmap to be displayed progressively as it is received (for example, as it is received over the Internet).
Let’s look at an example…
Imagine a file format:
- The 1st, 5th, 9th, 13th, etc. scanlines are stored first.
- The 2nd, 6th, 10th, 14th, etc. scanlines are stored next.
- The 3rd, 7th, 11th, 15th, etc. scanlines are stored next.
- The 4th, 8th, 12th, 16th, etc. scanlines are stored last.
In this case, aftter receiving the 1st, 5th, 9th, 13th (etc.) scanlines we have only a quarter of the image data. Obviously there are massive gaps in our image, but we can guess how to fill these gaps by simply duplicating the 1st scanline into the 2nd, 3rd and 4th, the 5th scanline into the 6th, 7th and 8th, and so on:
Next, we would receive the 2nd, 6th, 10th, 14th, etc. scanlines. We now have (combining this with the data already received), half of the image data. There are still many gaps, but we can guess how to fill these gaps by simply duplicating the 2nd scanline into the 3rd and 4th, the 6th scanline into the 7th and 8th, and so on. As you can see the image begins to look more recognisable:
Now, we would receive the 3rd, 7th, 11th, 15th, etc. scanlines. We now have (combining this with the data already received in the two previous stages), three quarters of the image data. There are still some gaps, but we can guess how to fill these gaps by simply duplicating the 3rd scanline into the 4th, the 7th scanline into the 8th, and so on. Now the image is even more recognisable:
Finally, we receive the remaining scanlines, and thus we complete our image.
The important point to note, is that we were able to begin displaying an approximation of the image, even when we had received only a fraction of the total image data. Furthermore, as we received more and more image data, we were able to progressively display the picture in stages until the final image was displayed.
This can be a very useful feature when transmitting images over the Internet (of course, it requires a Bitmap File Format that supports interlacing, and browser software capable of this type of progressive display), as it allows users to begin to see images even before they have completely downloaded, and increases the perceived speed of web pages’ display.
An actual example of a format that supports interlacing is the GIF file format. GIF interlaces based on every 8th scanline, which allows images to start to be displayed after only one eighth of their data has been received.