Make a PDF look like it was manually scanned (#snippet)

I live in Germany, and while many think we have things in order here, we still need to sort out bureaucracy. It’s a clu**fu** at best because German officials rely on paper – paper and handwritten signatures.
It can go so far that a…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

I live in Germany, and while many think we have things in order here, we still need to sort out bureaucracy. It's a clu**fu** at best because German officials rely on paper – paper and handwritten signatures.

It can go so far that a scanned document image is preferred over a nice and sharp PDF. I don't own a printer, let alone a scanner, so occasionally, I drag myself to the local copy shop to do official business.

Until now! I've been browsing Hacker News, and the shell script below takes a PDF and makes it look like it's been scanned.

#!/bin/sh
  ROTATION=$(shuf -n 1 -e '-' '')$(shuf -n 1 -e $(seq 0.05 .5))
  convert -density 150 $1 \
    -linear-stretch '1.5%x2%' \
    -rotate ${ROTATION} \
    -attenuate '0.01' \
    +noise  Multiplicative \
    -colorspace 'gray' $2

Side note: the convert command is part of the imagemagick tools and wasn't available on my machine. You might have to install it first. A brew install imagemagick did the trick for me, though.


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2023-03-16T23:00:00+00:00) Make a PDF look like it was manually scanned (#snippet). Retrieved from https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/

MLA
" » Make a PDF look like it was manually scanned (#snippet)." Stefan Judis | Sciencx - Thursday March 16, 2023, https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/
HARVARD
Stefan Judis | Sciencx Thursday March 16, 2023 » Make a PDF look like it was manually scanned (#snippet)., viewed ,<https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/>
VANCOUVER
Stefan Judis | Sciencx - » Make a PDF look like it was manually scanned (#snippet). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/
CHICAGO
" » Make a PDF look like it was manually scanned (#snippet)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/
IEEE
" » Make a PDF look like it was manually scanned (#snippet)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/. [Accessed: ]
rf:citation
» Make a PDF look like it was manually scanned (#snippet) | Stefan Judis | Sciencx | https://www.scien.cx/2023/03/16/make-a-pdf-look-like-it-was-manually-scanned-snippet/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.