Skip to content

Instantly share code, notes, and snippets.

@tetsuok
Created April 19, 2012 17:34
Show Gist options
  • Save tetsuok/2422489 to your computer and use it in GitHub Desktop.
Save tetsuok/2422489 to your computer and use it in GitHub Desktop.
Generate reduced EPS files
#!/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