#!/usr/local/bin/perl -w
use strict;

my @OPTS = ();
while(@ARGV) {
    last if ($ARGV[0] =~ m/ppm$/); 
    push(@OPTS, shift @ARGV);
}
for my $f (@ARGV) {
    my $outfile = $f;
    $outfile =~ s/ppm/jpg/i;
    my $cmd = "pnmtojpeg @OPTS $f > $outfile";
    print STDERR $cmd, "\n";
    system($cmd);
}

