[olug] picture conversion

Mark A. Martin mmartin at amath.washington.edu
Wed Sep 20 17:10:05 UTC 2000


If you go the perl script route, there is a perl interface to
ImageMagick called PerlMagick.  The primary page for PerlMagick resides
at

http://www.wizards.dupont.com/cristy/www/perl.html

and is part of the ImageMagick web site (and may have been written by
the author of ImageMagick).  The perl script for what you want to do
would be trivial (and you wouldn't have to store the file names in an
array to do it).

What you need can also be done with a trivial bash loop.  Since you
already have bash, that might be the way to go since it would save you
the trouble of downloading, installing, and learning to use something
new.  The following loop does what you want

for img in `ls *.rgb`
do
  name=${img%.*}
  convert $img gif87:$name.gif
done

You don't even have to save the loop in a file since it can be typed in
as a single line.  (But if you save the loop in a file, don't forget the
"#!/bin/bash" at the top of the file.)  This loop converts all of the
files with the extension .rgb to GIF files with the same name but with
the extension .gif.  If you want to know which file is being processed
at a given time, put an echo statement in the loop.  For example,

for img in `ls *.rgb`
do
  name=${img%.*}
  echo "Converting $img to $name.gif"
  convert $img gif87:$name.gif
done

BTW, I believe that the GIF files that will result will not be
compressed due to the CompuServe patent.  See the bash and convert man
pages and the ImageMagick web site
(http://www.wizards.dupont.com/cristy/ImageMagick.html) for more
information.

Mark
-- 
---------------------------------------------------------------------------
Mark A. Martin					Dept of Applied Mathematics
http://www.amath.washington.edu/~mmartin	University of Washington
---------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: olug-unsubscribe at bstc.net
For additional commands, e-mail: olug-help at bstc.net



More information about the OLUG mailing list