Netpbm Favicon Builder

I do a lot of web site maintenance, and everybody these days expects to have see a "favicon": the little custom icon that appears left of the URL in the address bar and bookmarks of most browsers. Favicons are loaded by the browser automatically, preferably by referencing a LINK REL element in the HEAD of the document being accessed. Older browsers expect to see Windows Icon Files), so it is probably best to supply those. But of course, this is a pain in the neck, especially in my Linux environment.

I have written a shell script to munge an arbitrary image in PNG (easily adaptable to most any other standard format) into a workable favicon. The script makes heavy use of utilities from the Netpbm collection. It takes a source image file as its argument, and makes a giant mess in the directory it is run in, including a favicon file that contains the image at a multiple of resolutions. The formats in the favicon are currently hard-coded to a recommendation from the ppmtowinicon manual page, but the script should be easily adaptable to include other formats. I left the garbage around because sometimes one wants to hand-edit it; the --prescaled flag will make the script use validly-named files that are already present rather than generating them itself.