ps2png-binary 831 B

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