Skip to content

Instantly share code, notes, and snippets.

@baicunko
Forked from jduckles/scanned_pdf.sh
Created May 19, 2020 12:17
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 baicunko/0c3bfae55c8b692f8aa66b06add29f20 to your computer and use it in GitHub Desktop.
Save baicunko/0c3bfae55c8b692f8aa66b06add29f20 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