How Does Lossy Compression Work?
The compression algorithm used in GIFs is LZW. LZW essentially looks for identical patterns of pixels along scan lines. If LZW finds an identical pattern later in the image it substitutes a token referring back to the original pattern (within a sliding window, which we’ll ignore). The more identical patterns of pixels, the smaller the file. Lossy compression simply helps the process along, by intelligently tweaking pixel values to match other patterns along scan lines. The more “lossy” compression you apply, the more programs like ImageReady and Fireworks scramble your scan lines. At lower settings, lossy compression is barely noticeable for most images. As you increase the degree of “lossiness” the effect becomes more pronounced (see Figure 3).