#! /bin/csh -f # # Script to convert postscript to (lo res) JPEG # if ($#argv < 2) then echo " Usage: jjPs2Jpeg file.ps file.jpeg " > /dev/tty exit 1 endif # the cmd line for ghost script is a mess. # try to make the code more legible. set device = "jpeg" set resolution = "4800" # tcsh is very lame. # We can only do integer math so paper width # and height need to be integer, hack around # this by setting up for 11x17 and then scaling... # # This means that your resolution should ideally # be a multiple of 2, but if you can live with # the truncation and roundoff, it's not a problem. # for 11x17 set scale to be 1, x=11, y=17 # i.e. divide 17x22 by 2 @ scale = 1 @ width = 11 @ height = 17 # for 8.5 x 11 set scale to be 2, x=17, y=22 # i.e. divide 17x22 by 2 @ scale = 2 @ width = 17 @ height = 22 # and here we just pick some dimensions @ scale = 1 @ width = 12 @ height = 12 @ nx = $width * $resolution @ nx /= $scale @ ny = $height * $resolution @ ny /= $scale # still need to account for portrait/landscape echo $nx $ny if ("$3" == "-P") then echo "Portrait layout" set size = "$nx""x""$ny" else echo "Landscape layout" set size = "$ny""x""$nx" endif echo "gs -sDEVICE=$device -r$resolution -g$size -SOutputFile=$2 $1" # now we actually run the job gs -sDEVICE=$device -r$resolution -g$size -SOutputFile=$2 $1 << % quit quit % echo " "