#!/usr/bin/perl -w use strict; use Imager; my $image = Imager->new; # Load the original image $image->open(file => $ARGV[0]) or die $image->errstr; # Get the dimensions of the picture print "Size: ", $image->getwidth, 'x', $image->getheight, "\n"; # Scale the picture to at most 150px in width or height my $resized = $image->scale( width => 150, height => 150, type => 'min' ); # Save the resized picture to disk $resized->write(file=>"tn_$ARGV[0]") or die $resized->errstr; __END__