Im2html - An Automatic Image Library Indexer

Im2html is a script for automatically producing and maintaining HTML indices of images directories, complete with thumbnails. Just for reference, here are the faces of, indexed with this programme.

The basic tool is im2html. It is typically invoked as:

	im2html -r directories
This will walk the directories named and create thumbnails (if missing) and an HTML file indexing the images. It is primarily interested in JPEG files, but will create JPEGs from TIFF or GIF images.

What im2html expects

By default, im2html creates a file index.html. If the file imindex.title exists it will use its contents as a title, otherwise it will make one. If the file imindex.header exists it will insert that at the top of the document. It then makes a terse index, with a reference to the parent directory's index, the subdirectories' indices, any other references as specified by *.href files (which are simply interpolated into the list, and are typically made with the script), and internal references to each image's description. Below this comes a list of the images. If there is an image.html file matching the image.jpg image, its text will be inserted above the thumbnail (image-small.gif).

Supporting tools

Really terse cross-reference hooks can be made with the script phref, viz:
	phref ../over/there/ Title For Over There > here.html
for a hook for here.jpg, or
	phref ../related/topic/ Related Topic > topic.href

A gzipped tar file (im2html.tar.gz) is here, containing the script itself and the supporting Perl modules not part of the standard Perl distribution. Im2html relies on a few subsidiary tools:

The PBMPLUS [FTP:pbmplus.tar.Z] or NetPBM [netpbm-1mar1994.tar.Z toolkit.
This is needed for the creation of thumbnails and the conversion of GIF or TIFF files to JPEG format.
The JPEG package.
Likewise. Visit the Indepentent JPEG Group.
The Image::Size perl module.
This links to the copy I'm using at present, which is 2.3. You probably want to go to CPAN for the latest version.
The fls programme
Once used to print the image file's size, now no longer needed, it can be handy to have for other purposes. A tarball is here: fls-03oct85.tar.gz .
The script to convert GIFs into JPEGs. The tif2jpg script is a link to gif2jpg. I should really convert GIFs to PNGs - GIFs' 8-bit colour model makes for grainy imagery anyway; coupling it with JPEG's lossy compression scheme feels like compounding the issue.
The thumbnail and jpgscale scripts.
Thumbnail is called to make the inlined thumbnail PNGs. It in turn calls jpgscale. As used it produces a GIF not more than 128 pixels wide or high with 16 colours. This is normally a very small yet quite recognisable thumbnail.
- Cameron Simpson <>