#!/bin/sh
#ps2gif script by Ian Hutchinson 1998; use at your own risk.
#You need Ghostscript and the pbmplus utilities installed. 
#A tex file at magstep4 gives characters about the right size.
if [ $# != 2 ] ; then
       echo " Usage: $0 <file.ps> <file.gif>" 1>&2
       exit 1
else 
	echo "Calling ghostscript to convert, please wait ..." >&2
     gs -r288 -sDEVICE=ppmraw -sOutputFile=- -sNOPAUSE -q $filein -c showpage -c quit | pnmscale 0.25 | pnmmargin -white 5 >temp.pnm
      ppmquant 256 temp.pnm | ppmtogif -transparent rgb:b2/b2/b3 >$2
#	gs -sDEVICE=ppmraw -sOutputFile=- -sNOPAUSE -q $1 -c showpage -c quit | pnmcrop| pnmmargin -white 1 | ppmtogif -transparent rgb:b2/b2/b2 >$2
fi
#| pnmgamma 1.0 | ppmdim 0.7 did not seem to be necessary.

