ImageMagick Perl Batch File

Oct 20, 2006
I wrote this perl script to convert a large number of images using ImageMagick. I tried doing it using ImageMagick itself on the command line, but it kept going in an infinite loop.


#/usr/bin/perl

opendir(DIR,"/tmp/pics");

while ($file = readdir(DIR) )
  {
        if ($file ne "." and $file ne "..")
        {
         print " $file ";
         my $convert = `/usr/local/bin/convert -resize x450 "/tmp/pics/$file" "/tmp/pics/$file"`;
        }
   }

closedir(DIR);
exit(0);

Comments

New Comment