Date Tags Perl

This small perl script is really just an example of using Image::Magick to crop and convert a sequence of images to prepare them for insertion into a video file. I used it for my PyODE Example 3. You could easily write this as a one-line command if desired.

# convert_frames

use Image::Magick;

$imgdir = "frames";
$prefix = "pyode_ex3";

$| = 1;

while ($infile = <$imgdir/$prefix.*.tif>) {
    print "$infile -> ";
    ($outfile = $infile) =~ s/\.tif$/.png/;

    $image = Image::Magick->new;
    $x = $image->Read($infile); warn "$x" if ($x);
    $x = $image->Crop(geometry=>'640x360+0+30'); warn "$x" if ($x);
    $x = $image->Write($outfile); warn "$x" if ($x);

    print "$outfile \n";