#! /bin/sh # Shell script to convert a picture to a gif file for inclusion into the # html text. # # What constitutes a picture depends on the local system. At U. Bristol # Geology, this is either an nplot file, or a raw, pre-sized Postscript file. # Inclusion of one of these is signalled by the locally defined macros # .PS / .PE # .PS takes 5 parameters: # 1 - picture height (in any unit acceptible to troff) # 2 - width in units or inches ("-" for default) # 3 - file name bearing picture (postscript or nplot text) # 4 - file type (ps, np, gif) # 5 - scale factor # # The script builds up input to the "pic" program that post-processes # troff-generated PostScript output and inserts the picture into the stream. # The resultant PostScript file is converted to a gif file for inclusion into # the html stream. n=0 file=- out=- psfile=- scale=1.0 density=72 trans=-notrans ftyp=unknown tmp=/tmp/pictogif$$ while [ $# -gt 0 ]; do case "$1" in -density) psfile="$2" ; shift ;; -ps) psfile="$2" ; shift ;; -trans*) trans= ;; *) n=`expr $n + 1` if [ $n = 1 ]; then file=$1 elif [ $n = 2 ]; then ftyp=$1 elif [ $n = 3 ]; then scale=$1 else echo "$0: Dont understand $1" > /dev/tty exit 1 fi ;; esac shift done if [ "$file" = "-" ]; then echo "$0: No input file given." exit 1 fi if [ "$psfile" = "-" ]; then echo "$0: No ps file given." exit 1 fi echo $file $scale > $tmp.pic (echo .lo; cat -) | psroff -me -t | sed -e 's/showpage//g' | pic -f $tmp.pic > $psfile pstogif $trans -density $density $psfile /bin/rm -f $tmp.pic