Office of Information Technology Office of Information Technology Susquehanna University Susquehanna University Office of Information Technology

Director's OfficeTechnology Support ServicesAdvanced TechnologiesTechnical OperationsAdministrative Information Services

Graphics Interchange Format (GIF)

The GIF is often used for buttons, bars, bullets, backgrounds, and small photos. As with most things, there are advantages and disadvantages to this graphic file format.

  • Advantages
    • File compression - GIF's use a file compression algorithm called LZW in which the image data is compacted by identifying and storing patterns, with each pixel represented by the RGB code, found in the image. Since these patterns are repeated elsewhere in the original image, only the index number of the pattern is stored in the compressed file, thus achieving data compression. When it is decompressed by the browser, it replaces the index numbers with the original patterns stored in the translation table.
    • Color palette stored in the file - Each GIF has access to roughly 16.8 million colors when it is created. The 2, 4, 8, 16, 32, 64, 128, or 256 colors that are selected to be in the palette are stored in a color table within the image file. In addition, the fewer the colors, the smaller the image size, although it's usually desirable to have more than 2 colors.
    • Supports transparency - GIF's can be told to ignore a particular color when processing the image for the browser. This creates images that appear to merge or overlay the existing background, which also gives the illusion that the image is not rectangular.
      Transparency Off Transparency On
      Without
      Transparency
      With
      Transparency
    • Supports interlacing - This can be used when you want your images to appear to load faster. When interlaced, the image's pixel rows are stored in an unusual order that cause the image to load in varying levels of increasing clarity until the final image is achieved. The example below illustrates how the image loads when interlaced. Scan 1 represents what the user first sees loading, then scan 2, scan 3, and finally after the final scan, the image is fully displayed.
      Susquehanna River Scan 1 Susquehanna River Scan 2 Susquehanna River Scan 3 Susquehanna River Scan 4
      Scan 1 Scan 2 Scan 3 Scan 4

      Susquehanna River Interlaced
      Simulation of Interlaced GIF loading
    • Supports limited animation - GIF's support animation in an extremely basic manner. You can store a number of images, called frames, in a single GIF file that are displayed sequentially and cause the appearance of a moving picture. It is by no means television quality animation, but it can serve a purpose. Note that too much animation on a page can distract and/or annoy the user.
      Susquehanna River Animation
    • Repeated saves will not degrade the image - Unlike the JPEG, repeatedly saving a GIF will not degrade the image.
  • Disadvantages
    • Supports a maximum of 256-color palette. This can be any 256 colors selected from the 16 million or so that are available to your computer. If your image contains more than 256 colors, the number of colors will be reduced to 256, which can lead to some image degradation.

      More information: Web Central's Display Types
    • Transparency support is on a pixel by pixel, on or off basis. This can make transparent edges jagged or sharp.
    • Animated images are stored frame by frame (ie. a four frame animation is trice as large as a two frame animation), which can cause file sizes to increase steeply.