Published
Make a PDF looked like a scanned doc using ImageMagick
You can make a PDF looked like a scanned document using ImageMagick. Useful for all the unfortunate orgs that still don’t accept electronic signatures and such.
First, make sure you have ImageMagick installed. On a Mac, you can run convert -v
on the command line and if it’s installed, you should see which version of ImageMagick you have as well as some settings. If you don’t have it installed, check out the ImageMagick download page (will probably need to install it via Homebrew if on a Mac).
Once you’re sure it’s installed, on the command line, you should navigate to the directory that contains the PDF you want to adjust. Next, you’ll run the command below to generate the “scanned” PDF. Be sure to change input.pdf
and output.pdf
to the filenames you want to use.
convert -density 140 input.pdf -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.1 +noise Multiplicative -flatten -attenuate 0.01 +noise Multiplicative -sharpen 0x1.0 -colorspace Gray output.pdf
Note: this is based on this Gist but with some tweaks to suit my preferences.