A study of shell script: Convert various image files formats into EPS format

I’m learning shell scripts these days.
Below is a script which converts various image file formats (jpg, png, etc…) into eps format using ImageMagick.
LaTeX user might find this script useful.

#!/bin/sh
#A script which converts various image file formats into EPS format.
#Usage: image2eps.sh filename
#Wild card can be used.

if [ $# = 0 ]
then
echo "Please specify the files you want to convert!"
echo "Usage: image2eps.sh filename"
exit 1
fi

for image in "$@"
do
if [ -f $image ]
then
convert $image `echo eps2:$image | sed 's/\..*$/.eps/'`
else
echo "$image: No such file"
fi
done

Print Friendly, PDF & Email

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください