Skip to content

Instantly share code, notes, and snippets.

@varun19299
Created October 18, 2020 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varun19299/03183df76723423bc97ae858c625f556 to your computer and use it in GitHub Desktop.
Save varun19299/03183df76723423bc97ae858c625f556 to your computer and use it in GitHub Desktop.
PDF to EPS via file compression (JPEG)

Converting pdf to eps

First convert to jpg (via convert, which is just imagemagick):

for x in pdf_images/*.pdf
do
filename=$(basename -- "$x")
extension="${filename##*.}"
filename="${filename%.*}"
convert -background white -alpha remove pdf_images/${filename}.pdf jpg_images/${filename}.jpg
done

Then convert to eps via ghostscript:

for x in jpg_images/*.jpg
do
filename=$(basename -- "$x")
extension="${filename##*.}"
filename="${filename%.*}"
convert jpg_images/${filename}.jpg eps3:eps_images/${filename}.eps
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment