ps2tiff 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. # ps2tiff
  3. #
  4. # Rasterizes a postscript file, saving as a set of g4 compressed
  5. # tiff images
  6. #
  7. # input: PostScript file
  8. # root name of output files
  9. # output: ccitt-g4 compressed tiff binary files for each page
  10. #
  11. # Restriction: the input PostScript file must be binary
  12. #
  13. # N.B. Requires ghostscript
  14. scriptname=${0##*/}
  15. if test $# != 2
  16. then
  17. echo "usage: " $scriptname " inpsfile outtifroot"
  18. exit -1
  19. fi
  20. inpsfile=$1
  21. outtifroot=$2
  22. # assert (input postscript filename ends in .ps)
  23. if test ${inpsfile##*.} != ps
  24. then
  25. echo $scriptname ": " $inpsfile "does not end in .ps"
  26. exit -1
  27. fi
  28. # output image size depending on resolution
  29. #echo "0 neg 0 neg" translate | gs -sDEVICE=tiffg4 -sOutputFile=${outtifroot}%03d.tif -r300x300 -q - ${inpsfile}
  30. echo "0 neg 0 neg" translate | ~/pckg/gs/ghostscript-8.53/bin/gs -sDEVICE=tiffg4 -sOutputFile=${outtifroot}%03d.tif -r300x300 -q - ${inpsfile}
  31. # output fixed image size
  32. #echo "0 neg 0 neg" translate | gs -sDEVICE=tiffg4 -sOutputFile=${outtifroot}%03d.tif -g2550x3300 -r300x300 -q - ${inpsfile}
  33. # use this to output to a single multipage tiff file
  34. #tiffcp -c g4 ${outtifroot}*.tif ${outtifroot}.tif