#!/usr/bin/perl -w #2004-10 http://kimbriggs.com/computers/ #Reduces all *.jpg photos 40% in current directory puts [KB] tagline on it. #Creates thumbnails with same name at 12% in subdirectory "thumbs". #Create a directory for the thumbnails. `mkdir thumbs`; #Load all jpgs into an array. Remove trailing line feed. @pix = `ls *.jpg`; foreach $pix (@pix) { chomp $pix; #Make the thumbnail in the thumbs directory. `convert -sample 12%x12% $pix thumbs/$pix`; #Resize by percent because should be rotated already. `convert -sample 40%x40% $pix $pix`; #Annotate the image with a web address. Upper left always works. `convert -fill black -draw 'roundRectangle 10,10 213,32 5,5' $pix $pix`; `convert -font Helvetica -fill white -pointsize 20 -draw 'text 15,27 "YOUR_TAG_HERE"' $pix $pix`; #Identify is returning a new line AND carriage return (or somethin), so chomp and chop. #Latest version does not have need for chop. #Print this out to have something to watch. $width = `identify -format "%w" $pix`; chomp $width; $height = `identify -format "%h" $pix`; chomp $height; print "Photo size is ", $width, " by ", $height, " pixels.\n"; }