A shell script to create low quality variants of PDF files with GhostScript

How it works:

  • Use find to get a list of all PDF files in the given directory.
  • For each file:
    • Is the file larger than the minimum required file size (5MB)?; skip, if no, continue if yes.
    • Create a low quality variant of the file in /tmp, named „originfilename_low.pdf“
    • Check if low quality variant has a lower file size; if yes move it to the origin folder. If the new file is larger then the origin, remove it.

The script can be found on GitHub, see here.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.