The greatest advantage of having command-line applications such as the ImageMagick suite is that one can create scripts to do all the image processing. That's what Brazillian programmer Eduardo Sztokbant did. He created shalbum, a shell script that uses ImageMagick to do all the image processing required to create a Web album, and released the program under the GNU General Public License (GPL). Since shalbum is a shell script that does not require any installation or dependencies, except for ImageMagick, it should run on all flavors of Linux and Unix.
Working with shalbum
You don't need to install shalbum to generate Web galleries of your images. Download the compressed tarball (tar.gz), which you can explode with
tar zxvf shalbum-1.0RC5.tar.gz. This creates the directory shalbum-1.0RC5, which has the shell script, the text of the GPL, a basic README, and an _options file.
To test shalbum, copy the script to your image directory, and at the terminal type
./shalbum. Shalbum looks for JPEG, TIFF, PNG, GIF, and BMP images in the directory to add to a gallery. It then creates a directory called Album (by default) in your image directory that includes an index.html file with tags for your thumbnails and links to the full-sized images.
The _options file is a new addition in version 1.0. As the name suggests, this file sets several basic options, such as name of the image gallery, size of the thumbnails and the larger image, and number of rows and columns on each gallery index page. You can copy this file to any image directory, make the appropriate changes, and when you run shalbum, the changes will be applied. If shalbum does not find an _options file in the image directory, it will use its default settings.
You'll probably want to use the _options file to set the name and email address displayed in the gallery. By default, the shalbum script displays Eduardo Sztokbant and his email address. This can be changed by setting
e_mail in the _options file, or by editing the shalbum script itself.
Shalbum doesn't have a command-line option to set the site author's name or email address, but it has others you can use to change options without changing the _options file or the script. For example, by using
shalbum -t gallery_name -d date you can provide a name and date for your gallery.
By default, shalbum will resize your images for the gallery; if you have particularly large images, shalbum will reduce them to a size better suited for Web browsing. However, if you'd like to prevent shalbum from resizing your images and creating thumbnails, use the
-i option to build the HTML files only.
Shalbum also offers the
mhd setting, which stands for Mostly Harmless Decisions -- basically a secondary set of defaults. If you scroll down in the script to the section "define default-options" and the section below it, you will see that mhd differs from the default only superficially in size of the images, number of rows and columns, etc.
The script is fairly easy to read and decipher because of Sztokbant's strategically placed comments. The script consists of four main parts, which are clearly labeled by function. The first part handles finding images, the second processes the image files, the third creates the indexes, and the final part exports the gallery and cleans up temporary files. The word "Part" sets off each section of the script.
In addition to the _options file, version 1.0 comes with two new features. You can now add a unique comment for each image in your gallery, and shalbum's galleries now have a slideshow feature.
To add comments to your image, create a _subtitles file in your image directory with the following structure:
filename.jpg=provide description filename2.jpg=this description is the comment image.png=you need to carefully enter the name and extension image2.png=of each image
You will have to add similar entries for every image for which you want a comment. You must also be sure
pic_label_type in the script is set to "conf," which is the default value. You can alternately set
pic_label_type to "number" or "filename" to display the picture number or its filename.
To test out the slideshow feature, open the index.html page for the gallery in your browser and click on the first image. In the middle, just above the image, you'll see the PLAY link. Click on it to start the slideshow. Sit back and enjoy the default five-second delay between the images. If you find five seconds to be too long or too short an interval, change
slideshow_time to something that suits you.
The biggest attraction of shalbum is that it's highly customizable. It also in active development; Sztokbant constantly upgrades and improves the script.
While you can create a Web album with a couple of mouse-clicks using GThumb or any other bulky GUI application, I find the idea of working at the command line too tempting to pass up.