#!/usr/bin/perl -w
#by Torben Menke
#http://www.entorb.net
# create thumbnails of pictures
# output = /.tmthumbs/FILENAME
use strict;
use warnings;
my @list = @ARGV;
#only .jpg files
@list = grep {m/\.jpe?g$/i} @list;
@list = grep {-f} @list;
my $thumbx = 60;
my $thumby = 45;
my $thumbdir = '.tmThumbs';
my $str;
print "Working on ".($#list+1)." files\n";
foreach my $file (@list) {
my $thumbfile = '';
my $dir = '';
if ($file =~ m'^(.*/)([^/]+)$'){
$dir = $1;
$_ = $2;
} else {$_ = $file;}
$dir .= $thumbdir;
$thumbfile = "$dir/$_";
if (!-d $dir){
mkdir ($dir)
}
print $file."\n";
$str = "convert -size ".$thumbx."x".$thumby." $file -quality 75 -resize ".$thumbx."x".$thumby."\\\> $thumbfile ";
system ($str);
}
Hope you found what you where looking for. Feel free to drop me a line
Torben