Demonstration of Compression Methods
GIF compression works by detecting when colors change along the horizontal axis. The more frequently colors change, the more information is required to describe the image. Think of it this way. If the entire row consists of black dots, the descriptions is essentially - it is a row of black dots. If the color changes, the description is something like - there are 20 black dots, then 5 white dots, then 45 black dots, etc.
Here is an interesting demonstration of how a compression algorithm works (based on Weinman, 1996). The demonstration is easy to perform yourself.
1) Create and save in PICT format a solid colored rectangle containing a few stripes of a different color.
2) Convert the file to GIF format (using Photoshop or some other tool). Save with a unique name.
3) Reload the original PICT


Now - here is the question. Are the two GIF files equal in size? If you think they are different, which file is larger? If you don't want to complete the entire process yourself, just download the two files displayed here ar see for yourself.
Weinman, L. (1996). Designing web graphics. Indianapolis: New Riders.