Skip to content

Instantly share code, notes, and snippets.

@fieri
Forked from scf37/simulate_scanned_PDF.md
Created April 11, 2022 05:13
Show Gist options
  • Select an option

  • Save fieri/02d40eaaa733976a2d53f18bea5033c0 to your computer and use it in GitHub Desktop.

Select an option

Save fieri/02d40eaaa733976a2d53f18bea5033c0 to your computer and use it in GitHub Desktop.
Simulate a scanned PDF with ImageMagick
convert -density 300 INPUT-FILENAME -resample 200 +noise Multiplicative -quality 85 -compose divide -linear-stretch 5%x0% -rotate 0.3 -compress jpeg OUTPUT-FILENAME
:: -density set the input DPI to 300
:: -resample set the output DPI to 200
:: +noise add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise)
:: -quality set JPEG Quality to 85%
:: -compose set the type of image composition (other Compose-Options: https://www.imagemagick.org/script/command-line-options.php#compose)
:: -linear-stretch (https://www.imagemagick.org/script/command-line-options.php#linear-stretch)
:: -rotate set Page rotation to 0.3 degrees
:: -compress set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment