Shell Scipt to convert a bunch of images using ‘convert’
by Amit
convert is a command line tool available with ImageMagick which can be used to convert between image formats. This shell script uses it to convert a bunch of images from ‘.ps’ to ‘.png’. Follow embedded instructions to customize it to your needs.
#!/bin/bash
# Uses the 'convert' utility to convert a bunch of images from one
#format to another
# the script should reside in the same directory as the images
# You need to have 'ImageMagick' installed
#(http://www.imagemagick.org/index.php)
# By Amit K.Saha
# Help taken from http://howtoforge.com/forums/showthread.php?t=4493
#to convert to/from different formats
# change 'ext' to reflect the format you want to convert "from"
# Chnage target to the format you want to convert to
ext=".ps"
target="png"
for i in *.ps
do
base=$(basename $i $ext) #to extract only the filename and NOT the extension
convert $i $base.$target
done
Thank you for this, it works great!