| 1 |
outf=`basename $1 eps`png |
| 2 |
prefwidth=160 |
| 3 |
prefheigh=144 |
| 4 |
prefratio=$(( 1000 * $prefwidth / $prefheigh )) |
| 5 |
tmpf=`mktemp pngmaker.XXXXXX` |
| 6 |
epstopdf --nogs -o $tmpf $1 |
| 7 |
epswidth=`identify $tmpf | cut -d " " -f 3 | cut -d x -f 1` |
| 8 |
epsheigh=`identify $tmpf | cut -d " " -f 3 | cut -d x -f 2` |
| 9 |
aspectra=$(( 1000 * $epswidth / $epsheigh )) |
| 10 |
if test $aspectra -ge $prefratio |
| 11 |
then resol=$(( 116 * $prefwidth / $epswidth )) |
| 12 |
else resol=$(( 116 * $prefheigh / $epsheigh )) |
| 13 |
fi |
| 14 |
echo " Resolution:" $resol "dpi." |
| 15 |
gs -q -sDEVICE=pngalpha -r$resol -dNOPAUSE -sOutputFile=$outf -dTextAlphaBits=4 -dGraphicsAlphaBits=4 $tmpf </dev/null |
| 16 |
mv $outf png/ |
| 17 |
rm $tmpf |
| 18 |
|