.gif
Our example of clip art is Tux, the Linux penguin. The image is taken from Nicu's Clipart in the Open Clip Art Library. Clip art images typically have only a few colors. In fact, a lot of clip art images are just solid black on white.
A close-up of a section of the Tux image shows some of the additional colors that most graphics programs will automatically put on the borders between colors in order to reduce the stairstep effect (aka "the jaggies") on curved and diagonal lines.
A blow-up of the palette for our Tux clip art image shows that the image has 80 distinct colors, which seems like a lot. After all, we can only count four colors in the picture: black, white, orange, and grey. Decent graphics programs will try to make your images look nice and smooth by adding in some in-between colors. Or rather, they will if you give them a chance.
The largest palette a GIF image can have is 256 colors. When you have a transparent color, like we did with our picture of Tux, that knocks it down to 255. If you start putting a lot of colors into your image, pretty soon your graphics program is going to run out of palette space. The first thing you'll notics will not be colors that look wrong. The first thing you'll notice is that some of the diagonals and curves will start looking jaggedy. Keep an eye out for that.
This is some plain black text, using one of our favorite fonts, "Girls Are Weird" by John Martz, available at Robot Johnny's Free Fonts.
Notice that the diagonals on the "K" and the "&" are very smooth. Once again, graphics programs will do their best to smooth things out for you.
Normally you'll create an image of text using your graphics program's text tool. We have a little advice from experience:
(except scans of photographs)
(if you absolutely have to). No equivalent in PNG or JPEG.
No transparency in JPEG.
Here's a picture of Helen (sorry, we don't know her last name) from the U.S. Fish and Wildlife Service Photo Archive. And no, we don't think Helen (whoever she might be) is either a fish or dedicated to the wild life.
One image is a GIF file, the way it came from the site. Evidently somebody over there hadn't read this page or they'd have known that GIFs are bad for photographs. But really, it doesn't look all that bad. The face looks a little flat, but that could be the lighting or the makeup.
The other image is the same file converted to a JPEG. Take a close look and see if you can tell the difference. Our intention was to make the images look exactly the same.
OK, now you can do whatever your browser supports (hovering your mouse pointer over the image usually works) to see which one is the GIF and which one is the JPEG. Did we succeed? Good. Then we seem to have proved that GIFs are fine for photographs!
Well, not really. The GIF image is 53,631 bytes and the JPEG is 20,166 bytes, some 2 and a half times smaller. That means for every picture of Helen the Fish and Wildlife Service archive can serve in a given time, we can serve 2 and a half pictures. If we were in competition (and make no mistake, your web page is in competition, even if it's only against your visitors' patience), we'd win hands down.
We have another picture on our JPEG page that illustrates what usually happens: the image doesn't look as good when you save it as a GIF. But even when you're lucky and get a perfect subject for a GIF like Helen was, your GIF file is still going to be too big.
Always look for banding
Some years after the GIF format had become widespread, Unisys announced that they owned a patent that covered some of the compression technology used to make GIFs. That was one of the factors that led to the development of the PNG file format. Later on, when Unisys started enforcing their patent by requiring a fee from people who made graphics programs that created gifs, there was a boycott of GIFs on the Web. The patent expired in the US in June 2003, but it's still active in some countries. Most web sites that changed over to PNG are keeping the PNGs because PNGs are a superior (smaller) format, and other sites continue to convert to PNGs and publish new images as PNGs.