Skip to content

Instantly share code, notes, and snippets.

@andyrbell
Last active December 17, 2024 06:59
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
@EarlGeorge
Copy link

Great

@fewaltix
Copy link

fewaltix commented Mar 16, 2022

Thank you!
I used zenity to add graphical input and output prompts:
convert -density 150 "$(zenity --file-selection --title="Select Input File" --file-filter=*[PpDdFf])" -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.4 +noise Multiplicative -attenuate 0.03 +noise Multiplicative -sharpen 0x1.0 -colorspace Gray "$(zenity --file-selection --save --title="Select Output File" --filename ".pdf")"

Can also be found here as a .desktop file, so the script can be started from the starter on Linux machines:
https://gist.github.com/fewaltix/c1437171d16671741aafe146751dbf9f

@leeeeeeeee2
Copy link

work

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