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