Draft - GIF or PNG

PNG versus GIF

In this tip we will explore the two main choices of graphic format that can be used on the Web to represent simple graphics, schemas or logos:

GIF

The GIF format is a format which compresses files using an algorithm called LZW, which keep traces of the colors and helps to reduce the size of the file.

GIF's strong point is that it is very widely supported and thus well established as the default choice for simple graphics on the Web. Compared to the other choices (especially PNG) GIF is not technically superior, but during the first years of the Web, when support for PNG was starting and growing, it was indeed a safer choice, and probably still is a safer choice at the time this QA Tips is written, though not by much.

One of the issues surrounding the GIF format is that the LZW algorithm was protected in the USA by a patent held by the company Unisys. The Unisys LZW patent expired in the USA on June 20, 2003. LZW patents are expired in Canada, France, Italy, Germany, the United Kingdom, and Japan.

PNG

PNG (Portable Network Graphics), an extensible file format for the lossless, portable, well-compressed storage of raster images. PNG provides a patent-free replacement for GIF and can also replace many common uses of TIFF. Indexed-color, grayscale, and truecolor images are supported, plus an optional alpha channel. Sample depths range from 1 to 16 bits.

For the Web, PNG really has three main advantages over GIF:

PNG also compresses better than GIF in almost every case (5% to 25% in typical cases).

Though in some cases, it's important to notice that PNG could have a bad support by old browsers or specific features like transparency. To be more informed on the level of support of PNG in different browsers, you should read:

Further Reading

About the "QA Tips"

The W3C QA Tips are short documents explaining useful bits of knowledge for Web developers or designers, hosted and produced by the Quality Assurance Interest Group at W3C.

While the tips are carefully reviewed by the participants of the group, they should not be seen as anything else than informative bits of wisdom, and especially, they are not normative W3C technical specifications.

Learn more about the Tips, how to submit your own pearls of wisdom, and find all the other QA tips in the Tips Index.

Created Date: 2003-08-20 by Karl Dubost
Last modified $Date: 2006/11/24 01:20:24 $ by $Author: ot $