Skip to content

Instantly share code, notes, and snippets.

@rittme
Created July 9, 2023 04:35
Show Gist options
  • Save rittme/7554bca1e62cb25df44389c69df20b33 to your computer and use it in GitHub Desktop.
Save rittme/7554bca1e62cb25df44389c69df20b33 to your computer and use it in GitHub Desktop.
Make image look like it was scanned
# A few options
convert -density 130 input.pdf -rotate 0.2 -attenuate 0.25 +noise Laplacian -colorspace Gray output.pdf
convert -density 150 input.pdf -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.4 +noise Laplacian -sharpen 0x1.0 -colorspace Gray output.pdf
convert -density 150 input.pdf -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.4 +noise Gaussian -sharpen 0x1.0 -colorspace Gray output.pdf
convert -density 150 input.pdf -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.4 +noise Gaussian -attenuate 0.03 +noise Laplacian -sharpen 0x1.0 -colorspace Gray output.pdf
convert -density 150 input.pdf -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.4 +noise Multiplicative -attenuate 0.03 +noise Laplacian -colorspace Gray output.pdf
convert -density 150 input.pdf -rotate "$([ $((RANDOM % 2)) -eq 1 ] && echo -)0.$(($RANDOM % 4 + 5))" -attenuate 0.4 +noise Multiplicative -attenuate 0.03 +noise Laplacian -sharpen 0x1.0 -colorspace Gray output.pdf
convert -density 130 input.pdf -rotate 0.2 -attenuate 0.2 +noise Laplacian -colorspace Gray output.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment