SWIGS: Structured Web Image Gallery System

Page Contents

Program Description

SWIGS is a system for creating hierarchically organized sets of thumbnail galleries. Multiple sizes for each image are produced automatically, and each image can be annotated with a relevant description, date, photo credit, etc. The image galleries (albums) have a tree structure, each album possibly containing pictures and/or additional albums. The album is made up of a set of web pages: a set of thumbnail pages for the images in the gallery, a text-only list of all the images in the album (with description if available), and a page listing all the sub-albums of the current album, with a description and sample image for each.

To create these web pages, images are arranged in a directory structure where each directory corresponds to an album. Each image can optionally have an associated text file that contains information about the image, and each directory can similarly contain a text file describing the set of images in the directory. This directory structure is then processed by a Perl script that creates web pages for each directory (album) based on HTML templates; information from the text files are appropriately inserted, thumbnails and various sizes of the images are created, and a complete set of web pages is generated. The SWIGS script originally began as a modification of IDS, version 0.21, but has now been almost completely rewritten. IDS is a CGI script that provides a nice way to dynamically generate image web pages; SWIGS creates static web pages that can be burned to CD or browsed offline (as well as online, of course).

The second component of the SWIGS system is a Java program named PDP, for Picture Description Program. It provides an easy way to browse a directory of images and create the description files used by the main SWIGS Perl script. The program also makes a fairly good general purpose image browser thanks to several nice features including the automatic predictive loading of images the user may want to view and a sophisticated image cache. The program is fully configurable (via a text file) as to the description fields it displays.

The primary developer SWIGS and author of this page is Brendan McMahan. I started developing SWIGS after buying a digital camera and realizing I would need a good way to organize the ridiculous number of pictures I was taking. The software has been used to put a large number of pictures on the Web to share with friends, and also to create a CD with over 600MB of images and HTML containing pictures from my time at Whitman College. This CD was given as something of a graduation present to many of my friends; the project would never have been completed without a tremendous amount of help from my good friend Brent Bryan. Brent is continuing to help me develop JIGS (see below) and SWIGS.

Project Status

The main Perl script for SWIGS works fairly well, and does most of what I want it to do. However, it has not been rigorously tested, and there is little documentation beyond the readme. Development has basically stopped on the main perl swigs script. Instead, I have been focusing my efforts on a Java implementation, which I am currently using to generate my own web pages. It has all the features of the old swigs, and many more. Why Java? Short answer: I'm a much better Java programmer than perl programmer. Long Answer: Swigs was getting too big for me to manage it as a one file perl script. It is also a fairly brittle and special purpose piece of code. I wanted something general, with clean separation of the framework code and the html creation code. That is, I wanted a general framework for scanning directories of images, creating thumbnails, reading description files, which works independently of the code that actual produces the code. The model is something like the javadoc/doclet model. The new project is called JIGS (Java Image Gallery System), and it accomplishes this goal very well, I think. However, it is still using a couple hacks for image transformation (the default Java is just too slow), and so I haven't made a formal release of the system. I would love to have help with any aspects of development with either JIGS or the original SWIGS script. If you make any changes or have suggestions or want to write documentation, please let me know.

The PDP program has just been released, but so far it seems to be working fairly well. Eventually I hope to include full support for the EXIF format that most digital cameras use.

Sample Gallery

Many of the pictures I have taken contain people, and I don't have explicit permission from many of those people to put the images on the web. So most of my online pictures aren't publicly available. However, I did sort through I few recent pictures and put together a sample album to demonstrate the basic capabilities of the software. If you think you might be interested in the program, you probably want to start by taking a look at this sample.


SWIGS is distributed under the GNU General Public License. The swigs.tar.gz file contains the latest version of the main SWIGS Perl script and the set of HTML templates used to create the sample gallery. The README file contains brief usage instructions, and there are a reasonable number of comments in the source for swigs.pl, but that is about it for documentation. Many of the simple behaviors of the program can be configured by changing values near the beginning of the script: sizes of images created, jpeg compression, etc. The script requires PerlMagick and the "Image::Size" Perl module (check www.cpan.org.).

Please visit SWIGS' Sourceforge File Page to download the latest version of the SWIGS script and the PDP.

Page created and maintained by Brendan McMahan, last modified April 26, 2001.