Skip to content

Instantly share code, notes, and snippets.

@cereal-s
Last active November 28, 2019 12:20
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 cereal-s/f03a4fab540c29405385710406f0e1af to your computer and use it in GitHub Desktop.
Save cereal-s/f03a4fab540c29405385710406f0e1af to your computer and use it in GitHub Desktop.
Add contrast to pale PDF document with ImageMagick and pdfimages

COMMANDS

  pdfimages -j -p file.pdf ./images/prefix
  cd images
  mogrify -level 80%,85% -sharpen 0x1 prefix*.jpg
  convert -background white -page a4 prefix*.jpg new.pdf

NOTES

If ImageMagick returns a not autorized error go to /etc/ImageMagick-VERSION/policy.xml and change the line:

  <policy domain="coder" rights="none" pattern="PDF" />

To:

  <policy domain="coder" rights="read|write" pattern="PDF" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment