Skip to content

Instantly share code, notes, and snippets.

@andyrbell
Last active September 8, 2025 18:04
Show Gist options
  • Save andyrbell/25c8632e15d17c83a54602f6acde2724 to your computer and use it in GitHub Desktop.
Save andyrbell/25c8632e15d17c83a54602f6acde2724 to your computer and use it in GitHub Desktop.
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@sophiebits
Copy link

If you want each page to be rotated by a different random amount, this worked for me:

magick -density 90 input.pdf -background white -seed 42 -rotate "%[fx:(u*2-1)*0.5]" -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment