My apologies..
I'm using Windows 2000, ActiveState Perl version 5.6.1 if you need to know that too.
Here is my current coding:
#!/usr/bin/perl
# Import Modules #
use File::Copy;
use Image::Magick;
use File::Find;
# Prompt for Directory #
print "Enter Directory: ";
chomp($dir = <STDIN>);
# Find Images #
find(\&mogrify, $dir);
# Resize Images #
# Write to thumbnails directory #
# With same filename extension #
sub mogrify {
$img = Image::Magick->new;
$img->Read($_);
# Test for Extensions #
if ($_ =~ /\.(\w+)$/) {
$ext2 = $1;
}
my $ext = $ext2;
$img->Resize('geometry' => "120x120", 'filter' => "Cubic");
$img->Write("$_"."-thumb"."\.$ext2");
}
# Make the directory of thumbnails #
system("mkdir thumbnails");
# Move all thumbnails to the thumbnails directory #
system("move *thumb*.*, thumbnails");
Sorry if the indentation's bad....
Is any of this the correct way to do it?
Thanks,
~firstbaseman83
|