#!/usr/bin/perl -w # # $Id: create-snapshot-montages,v 1.1 2004/06/19 11:50:37 suter Exp $ # Copyright (C) 2004 Mark Suter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use strict; sub usage { q{Suggested usage: rename 's/[^-\/.[:alpha:][:digit:]]+//g' * find -type f -name \*.JPG -print0 | xargs -0r identify -format "%wx%h %d/%f" | create-snapshot-montages lpr merge-*.eps }} ## One array for each size of image my %images = (); while(<>) { / ^ \s* $ /x and next; /(\d+x\d+) \s+ ([-\/.[:alpha:][:digit:]]+)/x or die usage; -f $2 and -r _ or die "Can't read file $2: $!\n"; push @{$images{$1}}, $2; } ## Usage if no valid input 0 == keys %images and die usage; ## Print each array, three at a time my $seq = 1; foreach my $geometry (keys %images) { while (my @list = splice @{$images{$geometry}}, 0, 3) { system("montage -page A4 -tile 1x3 -quality 100 -geometry $geometry @list merge-$seq.eps") == 0 or die; $seq++; } }