Created
April 19, 2012 17:34
-
-
Save tetsuok/2422489 to your computer and use it in GitHub Desktop.
Generate reduced EPS files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A script to generate reduced EPS files. | |
# Taken from http://electron.mit.edu/~gsteele/pdf/ | |
# | |
epsfile=$1 | |
pngfile=${epsfile/eps/png} | |
jpgfile=${epsfile/eps/jpg} | |
new_epsfile=reduced_${epsfile} | |
echo $new_epsfile | |
# Generate reduced png file from the original eps file. | |
gs -r300 -dEPSCrop -dTextAlphaBits=4 -sDEVICE=png16m -sOutputFile=$pngfile -dBATCH -dNOPAUSE $epsfile | |
# generate JPEG | |
convert -quality 80 $pngfile $jpgfile | |
# convert the JPEG to eps | |
convert $jpgfile eps2:${new_epsfile} | |
epstopdf ${new_epsfile} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment