GIF to PNG conversion

Since a patent on the LZW compression algorithm used in GIF image software is held by Unisys, and OpenSource software normally used under Linux is typically not licensed, all GIF images here are being replaced by PNG or JPEG.

This may result in images being inaccessible to older browsers. Apologies for the inconvenience.

For more information please see BurnAllGIFs.org

Converting a Webserver to use PNG

A few notes on the process of converting an old established webserver/development machine from using GIF images to using PNG images:

1. Static Web pages

Lazy way - convert all GIFs to PNG, replace the MIME type for GIF with image/png, and restart the server.
Better way - replace links to GIFs in HTML source with links to PNGs

Eric Raymond has made an excellent tool web2png available from www.tuxedo.org/~esr/gif2png. web2png is written in Python and requires version 1.6. The included C program gif2png (requires libpng) converts individual files and includes a "web" option to check for transparency and animations, which are not currently (1999) supported by browsers in PNG.

Other image conversion tools, such as "convert" from ImageMagick, may also be used.

I have written a couple of Perl scripts to assist in website conversion - pngbcol and web2png.pl.
pngbcol sets the transparent colour in a PNG image to the background colour ("bgcolor" parameter in the "body" tag) in an HTML page. This may be acceptable for current browsers and a page with a solid background. pngbcol requires GD version 1.22 , gd version 1.7, and Perl 5.004. It could probably be rewritten in a few lines of C by a competent C person.
web2png.pl is a Perl rehash of web2png which uses pngbcol and handles a couple of features found on my server - lots of junk GIFs which don't appear online and should be deleted, and local absolute URLs (required in pages which have come through server-side imagemap). Otherwise, web2png is probably better.

GIF images may also appear in external style-sheet documents and scripts, which may have a .css or .js extension. web2png now handles these.

2. Server Considerations

The image/png MIME type must be added to the server mime.types, if it does not already exist. In certain versions of Apache, the icons should be converted and srm.conf updated.

Occasionally server-side imagemaps may refer to GIFs directly. Old servers may use imagemap.conf which links to individual map files; later servers probably use server-parsed imagemap with .map files in the document tree.

CGI scripts

Scripts using older versions of GD, gd can be updated to generate PNG. If such CGI URLs end in "gif", web2png.pl will flag them with an error as an unfound local link (assuming a link such as "href=/cgi-bin/some.gif")

Scripts using old versions of e.g gnuplot or convert to generate GIFs may be updated. Later versions of gnuplot can generate PNG directly. Older versions used XBM images, which are compatible with old browsers but are monochrome.

Back-Compatibility

I had considered using content-negotiation features in Apache, or a missing-page handler, to deal with browsers which cannot accept PNG, or are using an external link to a now-deleted GIF. Currently, nothing is implemented.

Recent Netscape sends an "accept" header like "HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*" along with "HTTP_ACCEPT_ENCODING=gzip". It would be possible to check for JPEG and PNG here, and send an appropriate version. One could fall back to an XBM image, an old monochrome format I believe supported by all graphic browsers. Ideally one should return a text page where a link is followed (anchor), and an image where an embedded image is expected (img). Here is a demo missing_handler.pl which tries to redirect GIF requests to a file with a PNG suffix.

Andrew Daviel