It works only on indexed color images of 256 colors or less. GIF compression works best on images with relatively large areas of solid colors. It does not record the color value of each individual pixel. Instead it records the color value of a pixel, then how many pixels of the same color follow. Users don't need to wait for the entire image to be transferred before they can see something.
All data is restored when the image is opened.
When indexing an image, don't select 256 colors when you can get by with less. Try different color levels and use that which provides acceptable quality in as few colors as possible. An enhanced GIF format, GIF 89A allows one color to be specified as transparent. By this method, GIFs can appear not only as rectangular images, but as irregular shapes. The image is in fact rectangular, but border colors can be made transparent to give the effect of a cut-out shape.