#! perl -slw use strict; use GD; our $X ||= 100; our $Y ||= 100; for my $imgName ( @ARGV ) { my $img1 = GD::Image->new( $imgName ) or warn "$imgName: $!" and next; my $img2 = GD::Image->new( $X, $Y, 1 ); $img2->copyResampled( $img1, 0,0, 0,0, $X,$Y, $img1->getBounds ); ( my $thumbName = $imgName ) =~ s[(\..+$)][.thumb.png]; open OUT, '>:raw', $thumbName or warn "$thumbName: $!" and next; print OUT $img2->png; close OUT; }