#!/usr/local/bin/perl -w # # make_thumbnails: create a thumbnail version of each image named in @ARGV # # Gerald Oskoboiny, 7 Feb 1999 # # $Id: make_thumbnails,v 1.1 2002/04/29 05:29:57 gerald Exp $ $thumb_suffix = "-sm"; $border_size = 2; $total_height = 128; $thumb_height = $total_height - ( 2 * $border_size ); $convert = "convert"; $convert_opts = "-bordercolor '#000' -border ${border_size}x${border_size} -dither "; foreach $file (@ARGV) { if ( ! -r $file ) { print STDERR "Can't read $file! skipping it...\n"; next; } $thumb_name = $file; $thumb_name =~ s/\./${thumb_suffix}./; if ( -f $thumb_name ) { print STDERR "Thumbnail $thumb_name already exists! skipping it...\n"; next; } system "$convert -geometry x$thumb_height $convert_opts $file $thumb_name"; print "Done $file\n"; } exit;