-
-
Save andreadellacorte/cd45b93c84de1773a742b22e40380e36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Make a PDF look scanned. | |
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density). | |
# Project requires ImageMagick and GhostScript. This will do the trick on Ubuntu: | |
# sudo apt-get install ghostscript | |
# sudo apt-get install imagemagick | |
# This should work on macOS with Homebrew: | |
# brew install ghostscript | |
# brew install imagemagick | |
# If you're getting a PDF security error see https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion | |
INPUT_FILE=$1 | |
convert -density 150 ${INPUT_FILE} -colorspace 'gray' +noise Gaussian -rotate 0.5 -depth 2 scanned_${INPUT_FILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment