Summary:
When organizing my digital picture collection, I couldn't find a decent program
that generated thumbnails, resized images (the raw digital pictures are too high
resolution for the average CRT) and present them in a consistent, simple to
navigate way. So, I wrote some perl scripts that use
ImageMagick and later added the use of the
Image::Size perl module.
Here is a sample of the script results.
Not long ago, I found the program Web Album Generator by Mark McIntyre. It is an excellent program for the PC/Win32 platform and I recommend it for those who are scared easily by perl (like my Mom).
Requirements:
If you didn't get the hints before, here are the bare essentials:
Syntax:
The main scripts have 6 variables that need to be tweaked before you start using them.
The variables, tweaked for Win32, are:
my $mogrify="C:\\progra~1\\ImageMagick\\mogrify.exe"; my $copy = "copy"; my $move = "move"; my $dirsep = "\\"; my $ext = "JPG"; my $prev_index = "index.html";The variables I use under RedHat Linux are:
my $mogrify="/usr/X11R6/bin/mogrify"; my $copy = "cp"; my $move = "mv"; my $dirsep = "/"; my $ext = "JPG"; my $prev_index = "index.html";Make sure that you use double backslashes (\\) for Win32 paths, as a single backslash (\) will escape the next character and totally screw you up. For UNIX the standard directory seperator is slash (/).
Scripts:
Below is a summary of the scripts my collection:
# 1) all.pl will create subdirs: # raw # images # thumbnails # html # # 2.1) all.pl will $copy all pics into images # 2.2) all.pl will $move all pics into raw # # 3.1) all.pl will $mogrify all pics in images to $image_size # 3.2) all.pl will $copy resized pics into thumbs # # 4) all.pl will $mogrify all pics in thumbs to $thumb_size # # 5) all.pl will create HTML files (in html dir) for each pic # and generate left.html with preview of each thumb # # 6) all.pl will $copy ../template_index.html to index.html # 7) all.pl will $copy ../template_right.html to right.htmlBefore you begin, you'll want to make sure that you have all.pl, template_index.html and template_right.html all in the current directory. Then:
mkdir YYYYMMDDThen edit YYYYMMDD/index.html and YYYYMMDD/right.html to appropriately describe this directory of digital pictures and you're done.
#(copy all digital pictures to the YYYYMMDD directory)
cd YYYYMMDD
perl ../all.pl
cd YYYYMMDDThis will flip all 3 copies ('raw', 'images' and 'thumbnails') of the digital picture 90 degrees in the direction indicated.
perl ../flipleft.pl PC250001.JPG
perl ../flipright.pl PC250002.JPG
cd YYYYMMDDOnce you've flipped all you vertical images left, right, etc. you'll notice that the <IMG> tags have all the wrong WIDTH and HEIGHT elements. This script will simply re-generate every HTML page, overwriting the previous pages.
perl ../remkhtml.pl
Notes:
If you look at the scripts, the don't have the typical "#!/usr/local/bin/perl -w" or
equivalent as the first line. That is because
Win32 platforms don't provide the shebang syntax, or anything like it.
The fallout of all this is:
Source: