Navigation path

Graphics Interchange Format (GIF)

GIF ( Graphics Interchange Format ) is a bitmap image format that is widely used on the World Wide Web, both for still images (palletised colour raster images) and for animations.

 

Internet service provider CompuServe introduced GIF (Graphics Interchange Format) in 1987 as a format to transmit images with up to 256 different colours, replacing their earlier RLE format which was black and white only. In 1989 a revised specification was published that added some features to the format.

The original version of GIF was 87a  (or GIF87a ). In 1989, CompuServe devised an enhanced version, called 89a  (or GIF89a ), that added support for multiple images in a stream and storage of application-specific metadata. The two versions can be distinguished by looking at the first six bytes of the file, which, when interpreted as ASCII, read "GIF87a" and "GIF89a", respectively.

GIF is palette based: although any colour can be one of millions of shades, the maximum number of colours available is 256, which are stored in a ' palette ', a table which associates each colour number with an actual colour value. The limitation to 256 colours seemed reasonable at the time of GIF's creation because few people had the hardware to display more. Typical line drawings, cartoons, grayscale photographs, and similar graphics need only 256 colours. There exist ways to dither colour photographs by alternating pixels of similar colours to approximate an in-between colour, but this transformation inevitably loses some detail, and the algorithms to select colours and to perform the dithering vary widely in output quality, giving dithering a possibly unwarranted bad reputation. Additionally, dithering significantly reduces the image's compressability and thus works contrary to GIF's main purpose. A variation using the multiple images feature to draw each scanline in a separate palette can store any RGB colour out of 16 million, but this takes even more space than an uncompressed Windows bitmap and is useful only where lossless true colour is required. This variation works only for some viewers. Such images will seem defective on viewers with differing interpretations of the GIF specification regarding transparency and local palettes. 

Interlacing. The interlacing feature in a GIF file creates the illusion of faster loading graphics. What happens is that an image is presented in a browser in several steps. At first it will be fuzzy and blurry, but as more information is downloaded from the server, the image becomes more and more defined until the entire image has been downloaded. Very similar to the interlaced GIF is the Progressive JPEG. Interlacing is best for larger GIF images such as illustrations and photographs. Interlacing is a poor choice for small GIF graphics such as navigation bars, buttons, and icons. This was quite useful in the past since many users (especially home users) were on dial-up access where the bandwidth is very limiting. Users with faster connections are not likely to notice the difference.

Transparency. GIF (89a) allows transparent pixels. The transparency feature allows a graphic designer to designate the background of the image transparent. One colour entry in a single GIF or PNG image's palette can be defined as "transparent" rather than an actual colour. This means that when the decoder encounters a pixel with this value, it is rendered in the background colour of the part of the screen where the image is placed, also if this varies pixel-by-pixel as in the case of a background image.

Animation: GIF (89a) is the only widely used image format to support animation, unless you want to use FLASH or other vector-based animation formats. GIF provides an effective way of distributing small animations. A GIF file can contain more than one image. With certain software packages (most web browsers and image viewers), multiple-image GIFs can be played back as animations. It can even be used to distribute film clips of very low resolution and short length (there is no way to include sound).

Why use GIF?

The GIF format is particularly suited to rendering images that contain large blocks of the same colour, or large blocks of repeating patterns. Additionally, it does not suffer from the lossyness that leaves JPEG unable to display flat, clean, colour without losing all compression. Therefore, whenever a logo is seen on the internet, chances are that it is a GIF. For the same reason as GIF is generally used for logos so it is used for web page elements. Bevels, background patterns, borders, and other decoration are often in the .gif format.

If it is necessary to use transparency. Adding transparency to a GIF graphic can produce disappointing results when the image contains antialiasing. If you use an image-editing program to create a shape set against a background colour, this program will smooth the shape by inserting pixels of intermediate colours along the shape's boundary edges. This smoothing, or antialiasing , improves the look of screen images by softening jagged edges. Trouble starts when you set the background colour to transparent and then use the image on a Web page against a different background colour. The antialiased pixels in the image will still correspond to the original background colour.

The most web browsers can display GIFanimation without the need for any extra plug-ins, also, the GIF files containing the animations are compressed, and will download quickly. GIF animation is good for small image animations on a web page, and for short animation sequences.

To conserve bandwidth, do whatever you can to make your image compact and small. The most common method of reducing the size of GIF files is to reduce the number of colours on the palette. The strategy is to reduce the number of colours in your GIF image to the minimum number necessary and to remove stray colours that are not required to represent the image. A GIF graphic cannot have more than 256 colours but it can have fewer colours, down to the minimum of two (black and white). Images with fewer colours will compress more efficiently under GIF compression. Not all software will let you set the bits per pixel for GIF or the colours of the palette. Also, you should use a global palette whenever possible for all images in a GIF animation, instead of local palette with each image inside it.

Where Gifs are not used:

  • Photographs.
    Owing to the general restriction on the number of available colours in a single GIF image to 256 (although these 256 colours can be any of 16 million possibilities) the GIF format is unsuited to large colour photographs. It may however be acceptable for smaller (less than 500 pixels) photographs with less colours. Digital photographs commonly use the JPEG format.

File Extension and others notes:

  • .GIF:....... GIF image.

The MIME media type for GIF is image/gif (defined in RFC 1341).

Web Browsers Support: All latest versions of browsers support GIF format.

GIF Patent Software Information.

GIF became popular because it used LZW data compression (Lempel-Ziv-Welch, 1984), which was more efficient than the run-length encoding that formats such as PCX and MacPaint used, and fairly large images could therefore be downloaded in a reasonable amount of time, even with very slow modems. The LZW compression scheme is best at compressing images with large fields of homogeneous colour. It is less efficient at compressing complicated pictures with many colours and complex textures.

It was only later that people found out that LZW, the compression algorithm used to store the image data within GIF, was patented by Unisys (IBM also).

When GIF finally became popular, Unisys started charging license fees for creating software that writes GIF files, even website owners who used GIF images on their site. This eventually triggered the development of PNG, the Portable Network Graphics image file format, in 1995, meant as a replacement for GIF. However, mediocre support of PNG in browsers kept GIF from becoming extinct.

The LZW Unisys patent expired on 20 June 2003 in the USA, in Europe it expired on 18 June 2004, in Japan patent expired on 20 June 2004 and in Canada it expired on 7 July 2004. The U.S. IBM patent will expire 11 August 2006.

Decoding GIF is a different issue. The Unisys and IBM patents are both written in such a way that they do not apply to a program which can only uncompress LZW format and cannot compress. Therefore it can include support for displaying GIF files in GNU software (GNU is a recursive acronym for “ GNU's Not UNIX ”).

References & Background information:

GIF87a. The   GIF87a  Specifications.

GIF89a. The   GIF89a  Specifications.

Adobe PHOTOSHOP. The official site of the last version of PHOTOSHOP.

CorelDRAW. The official site of the last version of CorelDRAW.

MS VISIO 2002 Standard Edition. The official site of VISIO 2002 SE.

 
 

Related tools and services

  • Recommended Authoring Graphics Tools:
    • Adobe Photoshop 7. (For discussion: Attention nowadays is Status EV)
    • CorelDraw 10. (For discussion: Attention nowadays is Class C)
  • Recommended Authoring Graphics Tools (for non-professional use):
    • Microsoft Visio 2002.
    • Graphical tools provided by the operating system or Office (Paint 5.1, Photoed 3.0).
 
 

Training

Please consult SyslogRestricted area: This link points to internal pages and may not work if you are browsing as an external user., the training information system, which gives you access to the training catalogue, the training map and allows you to introduce your application for a training course.

 
 

Activities

  • How to decide the correct format for an Image.
 
 

Roles (concerned)