WWW FAQ: How can I make transparent and interlaced GIFs? And what are they?


How can I make transparent and interlaced GIFs? And what are they?

Transparent GIFs are useful because they appear to blend in smoothly with the user's display, even if the user has set a background color that differs from that the developer expected. They do this by assigning one color to be transparent -- if the web browser supports transparency, that color will be replaced by the browser's background color, whatever it may be.

Interlaced GIFs appear first with poor resolution and then improve in resolution until the entire image has arrived, as opposed to arriving linearly from the top row to the bottom row. This is great to get a quick idea of what the entire image will look like while waiting for the rest. This doesn't do much for you if your web browser doesn't support progressive display as the image is downloaded, but non-progressive-display web browsers will still display interlaced GIFs once they have arrived in their entirety.

You can make transparent and interlaced GIFs through the web without running any utility software on your own system through the Visioneering image manipulation page (URL is <URL:http://www.vrl.com/Imaging/>), which will access your image through the web and produce an enhanced version for you to save.

To create transparent and interlaced GIFs under Unix, check out David Koblas' giftool, a program which can manipulate those options and many more aspects of your GIF file.

For Windows PCs, try Lview Pro, version 1A or later, available by anonymous FTP from oak.oakland.edu in the directory SimTel/win3/graphics:

<URL:ftp://oak.oakland.edu/SimTel/win3/graphics>

As well as from many mirror sites.

You can also create transparent and interlaced GIFs using the widely available NETPBM tools (an enhanced version of the older pbmplus tools, which do not support these options). The following Unix shell script, contributed by Shane Castle, can make any GIF image transparent if a recent version of the netpbm utilities has been installed:

#!/bin/sh
if [ $# -lt 2 ]
then
    echo "Usage: transparize gifname color"
    echo "  gifname - name of GIF file"
    echo "  color   - color ID to make transparent"
    exit 1
fi
giftoppm $1 | ppmtogif -interlace -transparent $2 > /tmp/$$.gif
if [ $? -eq 0 ]
then
    mv /tmp/$$.gif $1
else
    rm /tmp/$$.gif
fi
Make the script executable using the chmod command. Usage is as follows:
transparize <image.gif> <transparent-color>

In addition, there is a document explaining transparent GIFs available at the URL http://melmac.corp.harris.com/transparent_images.html . You can fetch the program giftrans by anonymous ftp from ftp.rz.uni-karlsruhe.de at the path /pub/net/www/tools/giftrans.c.

There is also a Perl Script (URL is: <URL:http://www.wg.omron.co.jp/~jfriedl/perl/#transgif> ) which makes transparent GIFs.

There are also five utilities for the Macintosh, Transparency ( <URL:http://www.med.cornell.edu/~giles/projects.html#transparency> ), Graphic Converter (available from the "usual Macintosh FTP sites", such as mac.archive.umich.edu; see the Macintosh newsgroups for general information on where to retrieve Macintosh software), Imagery (again, available from many Macintosh FTP sites), and clip2gif (available by anonymous FTP from orathost.cfa.ilstu.edu in the directory /public/oratClasses/ART389.88Seminar/software and from many other sites including Info-Mac in the directory gst/grf).

A unique approach to the problem is offered by Imagizer (URL is <URL:http://www.minet.com/minet/imagizer.html> ), which transforms your images on the fly when sending them to the user, supporting thumbnails and TIFF-GIF conversion as well as interlacing. (Of course, there is a tradeoff between storage space and CPU usage.)


World Wide Web FAQ