#!/bin/sh # # pstogif # # Script to convert an arbitrary PostScript image to a cropped GIF image # suitable for incorporation into HTML documents as inlined images to be # viewed with Xmosaic. # # This is a modified version of the pstoepsi script # by Doug Crabill dgc@cs.purdue.edu # # Note in the USAGE line below, the source PostScript file must end # in a .ps extention. This is a GhostScript requirement, not mine... # # This software is provided without any guarantee. # # Nikos Drakos, nikos@cbl.leeds.ac.uk # Computer Based Learning Unit, University of Leeds. # # Tue Jun 8 13:11:53 BST 1993 USAGE="Usage: $0 .ps .gif" ### Edit these variables if you want to run the script outside the translator ### GS='/share/bin/gs' PSTOPPM='/epoch/u2/thrift/bin/pstoppm.ps' PNMCROP='/share/bin/pnmcrop' PPMTOGIF='/share/bin/ppmtogif' ###################################################################### BASE=`basename "$1" .ps` if [ $# -ne 2 -o ! -f "$1" -o "$1" = "$BASE" ] ; then echo $USAGE 1>&2 exit 1 fi trap 'rm -f ${BASE}.ppm; exit' 1 2 3 4 13 15 $GS -q -dNODISPLAY $PSTOPPM << ND 100 100 ppmsetdensity ($BASE) ppm1run ND if test -f ${BASE}.ppm then $PNMCROP ${BASE}.ppm | $PPMTOGIF - > $2 else for i in `ls ${BASE}.[1-9]*ppm` do $PNMCROP $i | $PPMTOGIF - > `echo $i |sed 's/\.\(.*\)ppm/\1\.gif/'`; echo "Writing `echo $i |sed 's/\.\(.*\)ppm/\1\.gif/'`" done fi rm -f ${BASE}.ppm rm -f ${BASE}.[1-9]*ppm exit 0