Skip to content

Instantly share code, notes, and snippets.

@jduckles
Last active October 12, 2021 22:29
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jduckles/29a7c5b0b8f91530af5ca3c22b897e10 to your computer and use it in GitHub Desktop.
Save jduckles/29a7c5b0b8f91530af5ca3c22b897e10 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Make a PDF look scanned.
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density).
INPUT_FILE=$1
/usr/local/bin/convert -density '80' ${INPUT_FILE} -colorspace 'gray' -linear-stretch '3.5%x10%' \
-blur '0x0.5' -attenuate '0.25' +noise Gaussian -rotate 0.5 \
-compress lzw -quality 50 scanned_${INPUT_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment