- Illinois State Museum - - ISM Programs -

Moving Postscript to GIF (ps2gif)

Updated ue Jun 20 13:57:47 CDT 1995
Here is the script that:
  1. Translates the postscript file to a ppm file by using ghostscript (/usr/local/bin/gs)
  2. Crops the ppm file (/usr/local/netpbm/pnmcrop)
  3. Translates the ppm to a gif (/usr/local/netpbm/ppmtogif)
  4. Cleans up /tmp
  5. Does some gn-specific stuff to make the new gif visible to the http server (mkmenus and mkcache)
The inset lines in the script below are really part of previous line, I just wrapped them so it was easier to read.

Note: The variable $1 is the name made up of %age%%taxon%%dist%, and $2 is %pid%, as passed from the AML.


#!/bin/sh
# for moving a postscript file to 
/usr/local/bin/gs  -q -dNOPAUSE -I/usr/local/ghostscript/fonts 
  -sDEVICE=ppm -sOutputFile=/tmp/$1$2.ppm -- /tmp/$1$2.ps 
rm /tmp/$1$2.ps
/usr/local/netpbm/pnmcrop  /tmp/$1$2.ppm 2> /dev/null | 
  /usr/local/netpbm/ppmtogif  > /u/WWW/research/faunmap/query/images/$1.gif 
  2> /dev/null
rm /tmp/$1$2.ppm
cd /u/WWW/research/faunmap/query/images
chmod a+r $1.gif
/u/WWW/mkmenus 2> /dev/null
/usr/local/bin/mkcache -q

ghostscript
Ghostscript is a postscript interpreter that is freely available on the net. I got my copy of the source code from ftp://aixpdslib.seas.ucla.edu, but had to compile it rather than use the binaries because I have a problem with my xwindows right now. You can find out more at the Ghostscript home page.
The netpbm utilities (pnmcrop, ppmtogif)
The netpbm utilities are a set of programs for the manipulation and translation of various raster-type image formats. The ppm file that is created by ghostscript is very large, about 5Mb! I have a copy of ghostscript on my pc that will make a gif directly, and this would save some of the problem, but I have not yet found the same thing for the unix version. Still, the netpbm part of it is small in terms of processing time. Things will be improved when Arc/Info can create gifs (or jpegs) more directly. Anyway, I learned about the netpbm utilities when I was learning how to produce mpeg animations of Arc/Info output, and I have described them elsewhere.

| ISM Home | | General Information | | Programs | | Events | | Exhibits | | Collections | | Sites | | Membership |


© Illinois State Museum Society-- Last updated 21-Mar-96 by Erich Schroeder