ps2png-gray 765 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # ps2png-gray
  3. #
  4. # Rasterizes a postscript file, saving as a set of 8 bpp png images
  5. #
  6. # input: PostScript file
  7. # root name of output files
  8. # output: 8 bpp png files for each page
  9. #
  10. # N.B. Requires ghostscript
  11. scriptname=${0##*/}
  12. if test $# != 2
  13. then
  14. echo "usage: " $scriptname " inpsfile outpngroot"
  15. exit -1
  16. fi
  17. inpsfile=$1
  18. outpngroot=$2
  19. # need mysterious "primer"
  20. # choose one of the two options below
  21. # output image size depending on resolution
  22. echo "0 neg 0 neg" translate | gs -sDEVICE=pnggray -sOutputFile=${outpngroot}%03d.png -r300x300 -q - ${inpsfile}
  23. # output fixed image size
  24. #echo "0 neg 0 neg" translate | gs -sDEVICE=pnggray -sOutputFile=${outpngroot}%03d.png -g2550x3300 -r300x300 -q - ${inpsfile}