#!/bin/sh # ps2web by David Dumas # Turn a postscript or pdf file into a bunch of single-page png files: # slide01.png, slide02.png, etc. # REQUIRES IMAGEMAGICK # see http://www.imagemagick.org/ if [ $# -lt 1 ]; then echo 1>&2 Usage: $0 DOCUMENT.ps [ghostscript options...] exit 127 fi # Create TIFF files first because this option seems to give the best # antialiased output. (Using AFPL Ghostscript 8.14) gs -dBATCH -dNOPAUSE -sDEVICE=tiff24nc -sOutputFile=slide%02d.tif -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dMaxBitmap=50000000 $* for fn in slide??.tif; do newfn=`echo $fn | sed 's/\.tif/\.png/'` convert $fn $newfn if [[ -a $newfn ]]; then rm -f $fn fi done exit 0