Last active
June 21, 2023 21:36
-
-
Save premek/0f3714b1a14a1c92f61c9c9c67f491c3 to your computer and use it in GitHub Desktop.
make an image look like it was scanned
This file contains hidden or 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
# separate pdf pages | |
convert -density 400 doc.pdf page-%0d.jpg | |
# use gimp to insert the signature at the right place at the right page, remove unnecessary pages etc | |
# scan | |
for F in page*jpg; do | |
convert -resize 1800x1800 -density 95 -flatten "$F" -rotate "0.$(( ( RANDOM % 2 ) + 3 ))" +repage -attenuate "0.$(( ( RANDOM % 8 ) + 20 ))" +noise Gaussian -quality 85 -compress JPEG -colorspace gray "$F-scanned.jpg" | |
done | |
# combine the pages into a pdf | |
convert *scanned.jpg scan.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment