Guest User

Batch recompress PDF's for less volume

a guest
Jun 13th, 2018
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.58 KB | None | 0 0
  1. #!/bin/bash
  2. # Recompress all the PDF's in the current directory
  3. # with ImageMagic convert utility for less volume.
  4. # -------------------------------------------------
  5. # Experiment with these settings for optimal result
  6. # QUALITY : 1..99 / JPEG compression quality
  7. # DENSITY : 100..600 / Dots per inch (VxH)
  8. QUALITY=30
  9. DENSITY=150
  10. # -------------------------------------------------
  11. for FILE in *.pdf ; do
  12.   echo -en "Compressing file ${FILE}... "
  13.   convert -density ${DENSITY}x${DENSITY} -quality ${QUALITY} -compress jpeg "${FILE}" "${FILE}_recompressed.pdf" && echo -e "OK"
  14. done
Advertisement
Add Comment
Please, Sign In to add comment