3 # Convert images to PDF
5 convert=`which convert`
6 if [ -z "$convert" ] ; then
7 echo "Cannot find the 'convert' utility" >&2
8 echo "Do you have imagemagick installed?" >&2
12 for filetype in png jpg; do
13 for file in *.${filetype}; do
14 pdf=`echo $file | sed -e "s/${filetype}/pdf/"`
15 if [ -r "$file" ] && [ ! -e "$pdf" ] ; then
17 back*|bckgrnd*|brdr*|forward*|left*|right*|title*|toc*) ;; # ignore HTML specific images
18 ac*|crt*|random*) ;; # ignore unused images
19 ill*|small*|map*) echo "Converting $file to PDF ..."; convert $file $pdf ;;
20 *) echo "Trimming and converting $file to PDF ..."; convert -trim +repage -transparent white $file $pdf ;;