#!/usr/bin/perl -w # RUN THIS ON A MACHINE WITH ImageMagick 6.x.x OR HIGHER # The -distort option is not available in older revs. # # Greg Ercolano 2008 # my $frm = 546; # start frame my $efrm = -1; # end frame (-1 = entire range) my $filename = defined($ARGV[0]) ? $ARGV[0] : "out"; my $comp = "$filename-left-seq2-comp.tga"; my $compw = 1000; # comp image's width my $comph = 400; # comp image's height $ENV{SHELL} = "/bin/sh"; # force use of the bourne shell for ( my $off = 390; $off>0; $off-=10 ) { system("banner OFFSET $off"); # CREATE EMPTY COMP IMAGE unlink($comp); system("convert -size ${compw}x${comph} 'XC:#000000' $comp"); my $x = 0; while ( 1 ) { my $in = sprintf("$filename-%04d.tga", $frm); if ( $frm++ > $efrm && $efrm != -1 ) { print "--- REACHED SPECIFIED END FRAME $efrm\n"; exit(0); } if ( ! -r $in ) { print "--- NO MORE FRAMES\n"; exit(0); } print STDERR "Working on $comp\n"; print STDERR " 1) Crop scanline, append to comp\n"; my $crop = "convert $in -crop 1x400+${off}+0 tmp.bmp"; print STDERR " Executing: $crop\n"; if ( system($crop) != 0 ) { print STDERR "--- CROP FAILED\n"; exit(1); } print STDERR " 2) Composite scanline into larger image\n"; my $comp = "composite -geometry +$x+0 tmp.bmp $comp $comp"; print STDERR " Executing: $comp\n"; if ( system($comp) != 0 ) { print STDERR "--- COMP FAILED\n"; exit(1); } $x++; # next vertical scanline if ( $x >= $compw ) { print "HIT END OF TILED IMAGE\n"; exit(0); } } print "--------- CREATING: out-left-seq2-comp-1pixel-\@x=$off.jpg\n"; system("convert $filename-left-seq2-comp.tga out-left-seq2-comp-1pixel-\@x=$off.jpg"); }