Add rule regarding safekeeping of special objects in Kai Monastery. Harmonise translation
[project-aon.git] / common / pdf / build / convert-images.sh
1 #!/bin/sh
2
3 # Convert images to PDF
4
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
9     exit 1
10 fi
11
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
16             case $file in
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 ;;
21             esac
22         fi
23     done
24 done
25
26 exit 0