I tried the Image::Magick module a while ago but never got it working. You can use ImageMagick directly though, without the module -- it comes with a bunch of utility programs. I found an old resizing script of mine that uses "mogrify.exe". Here's part of the script:
$ENV{'PATH'} = "C:\\Program Files\\imageMagick;" . $ENV{'PATH'};
# ...
for my $file (@files)
{
$fileNumber++;
my $newFile = "$largeDir\\$basename$fileNumber.JPG";
print "$fileNumber copying $file...\n";
copy("$originalDir\\$file", $newFile);
open(INFO, "identify $newFile |");
my $info = <INFO>;
close INFO;
my ($width, $height) = ($1, $2) if ($info =~ /\s(\d+)x(\d+)\s/);
my ($newWidth, $newHeight, $thumbWidth, $thumbHeight);
if ($width == 1200 && $height == 1600)
{
($newWidth, $newHeight) = (600, 800);
($thumbWidth, $thumbHeight) = (98, 130);
}
elsif ($width == 1600 && $height == 1200)
{
($newWidth, $newHeight) = (800, 600);
($thumbWidth, $thumbHeight) = (130, 98);
}
else
{
($newWidth, $newHeight) = (600, 600);
($thumbWidth, $thumbHeight) = (98, 98);
}
my $newDimensions = $newWidth . 'x' . $newHeight;
my @command = ('mogrify',
'-quality',
'100',
'-geometry',
$newDimensions,
$newFile);
print "mogrifying $newFile...\n";
system(@command);
(Note: I've only used this code with a version of ImageMagick that I downloaded 4 or 5 years ago.)
-Joe |