-
-
Save fieri/02d40eaaa733976a2d53f18bea5033c0 to your computer and use it in GitHub Desktop.
Revisions
-
Benny Samir H revised this gist
Nov 24, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Simulate a scanned PDF with ImageMagick 1. Download and install [Ghostscript](http://ghostscript.com/download/gsdnld.html) and [ImageMagick + Convert Module](https://www.imagemagick.org/script/binary-releases.php) 2. Execute the following command in the console (change the filename) ``` $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf -
Benny Samir H revised this gist
Nov 23, 2016 . 1 changed file with 0 additions and 94 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,94 +0,0 @@ -
Benny Samir H revised this gist
Nov 23, 2016 . 1 changed file with 94 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,94 @@ #!/usr/bin/env python3 import os import sys import subprocess import threading, queue from datetime import datetime ''' If you want use Drag and Drop, add this to the windows registry (or include into a .reg file and execute the file): Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler] @="{86C86720-42A0-1069-A2E8-08002B30309D}" ''' # Important for Drag and Drop! Change current work directory to the directory of the script os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input') output_dir = os.path.abspath('output') class converter(threading.Thread): workqueue = queue.Queue() lock = threading.Lock() inited = False def __init__(self): threading.Thread.__init__(self) @staticmethod def init(): converter.inited = True for thread in [converter() for _ in range(os.cpu_count())]: thread.setDaemon(True) thread.start() @staticmethod def wait(): return converter.workqueue.join() @staticmethod def put(input_filename, output_filename): if converter.inited is False: converter.init() converter.workqueue.put((input_filename, output_filename)) def run(self): while True: input_filename, output_filename = converter.workqueue.get() s = 'convert -density 200 "%s" -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray "%s"' % (input_filename, output_filename) err, _ = subprocess.Popen(s, stdout=subprocess.PIPE, shell=True).communicate() if err: sys.stderr.write(err) sys.stderr.flush() converter.lock.acquire() print(output_filename) converter.lock.release() converter.workqueue.task_done() def walkDir(dir): for root, dirs, files in os.walk(dir): for file in filter(lambda x: x.endswith(".pdf"), files): converter.put(os.path.join(root, file), os.path.join(output_dir, file)) def main(): if not os.path.isdir(output_dir): os.makedirs(output_dir) if sys.stdin.isatty() and len(sys.argv) == 1: walkDir(default_input_dir) else: files = sys.argv[1:] if sys.stdin.isatty() is False: files += [line.rstrip('\n') for line in sys.stdin.readlines()] for x in files: x = os.path.abspath(x) if os.path.isdir(x): walkDir(x) elif os.path.isfile(x) and x.endswith(".pdf"): converter.put(x, os.path.join(output_dir, os.path.basename(x))) converter.wait() if __name__ == "__main__": try: main() except KeyboardInterrupt: pass -
Benny Samir H revised this gist
Nov 22, 2016 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -34,8 +34,8 @@ Windows Registry Editor Version 5.00 # Important for Drag and Drop! Change current work directory to the directory of the script os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input') output_dir = os.path.abspath('output') def process(input_filename, output_filename): if not os.path.isdir(output_dir): @@ -56,7 +56,7 @@ def process(input_filename, output_filename): def walkDir(dir): for root, dirs, files in os.walk(dir): for file in filter(lambda x: x.endswith(".pdf"), files): process(os.path.join(root, file), os.path.join(output_dir, file)) def main(): if sys.stdin.isatty() and len(sys.argv) == 1: @@ -71,7 +71,7 @@ def main(): if os.path.isdir(x): walkDir(x) elif os.path.isfile(x) and x.endswith(".pdf"): process(x, os.path.join(output_dir, os.path.basename(x))) if __name__ == "__main__": try: -
Benny Samir H revised this gist
Nov 22, 2016 . 1 changed file with 21 additions and 32 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -37,61 +37,50 @@ os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def process(input_filename, output_filename): if not os.path.isdir(output_dir): os.makedirs(output_dir) s = 'convert -density 200 "%s" -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray "%s"' % (input_filename, output_filename) err, out = subprocess.Popen(s, stdout=subprocess.PIPE, shell=True).communicate() if err: sys.stderr.write(err) sys.stderr.flush() elif out: if sys.stdout.isatty(): print(out) sys.stdout.write(output_filename+"\n") sys.stdout.flush() def walkDir(dir): for root, dirs, files in os.walk(dir): for file in filter(lambda x: x.endswith(".pdf"), files): process(os.path.join(root, file), str(output_dir + file)) def main(): if sys.stdin.isatty() and len(sys.argv) == 1: walkDir(default_input_dir) else: files = sys.argv[1:] if sys.stdin.isatty() is False: files += [line.rstrip('\n') for line in sys.stdin.readlines()] for x in files: x = os.path.abspath(x) if os.path.isdir(x): walkDir(x) elif os.path.isfile(x) and x.endswith(".pdf"): process(x, output_dir + os.path.basename(x)) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass except Exception as e: sys.stderr.write(e) sys.stderr.flush() ``` ### PowerShell -
Benny Samir H revised this gist
Nov 21, 2016 . 1 changed file with 0 additions and 129 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,135 +21,6 @@ $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf import os import sys import subprocess ''' If you want use Drag and Drop, add this to the windows registry (or include into a .reg file and execute the file): -
Benny Samir H revised this gist
Nov 21, 2016 . 1 changed file with 49 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -117,6 +117,55 @@ os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) filledLength = int(round(barLength * iteration / float(total))) bar = '█' * filledLength + '-' * (barLength - filledLength) sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percent, '%', suffix)), if iteration == total: sys.stdout.write('\n') sys.stdout.flush() def process(input_filename, output_filename): if not os.path.isdir(output_dir): os.makedirs(output_dir) s = 'convert -density 200 "%s" -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray "%s"' % (input_filename, output_filename) err, out = subprocess.Popen(s, stdout=subprocess.PIPE, shell=True).communicate() if err: print(err) elif out: print(out) def walkDir(dir): for root, dirs, files in os.walk(dir): files = list(filter(lambda x: x.endswith(".pdf"), files)) i = 0; printProgress(i, len(files), prefix = 'Progress:', suffix = 'Complete', barLength = 50) for file in files: process(os.path.join(root, file), str(output_dir + file)) #!/usr/bin/env python3 import os import sys import subprocess import win32api ''' If you want use Drag and Drop, add this to the windows registry (or include into a .reg file and execute the file): Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler] @="{86C86720-42A0-1069-A2E8-08002B30309D}" ''' # Important for Drag and Drop! Change current work directory to the directory of the script os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) -
Benny Samir H revised this gist
Nov 21, 2016 . 1 changed file with 43 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -74,6 +74,49 @@ os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) filledLength = int(round(barLength * iteration / float(total))) bar = '█' * filledLength + '-' * (barLength - filledLength) sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percent, '%', suffix)), if iteration == total: sys.stdout.write('\n') sys.stdout.flush() def process(input_filename, output_filename): if not os.path.isdir(output_dir): os.makedirs(output_dir) s = 'convert -density 200 "%s" -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray "%s"' % (input_filename, output_filename) err, out = subprocess.Popen(s, stdout=subprocess.PIPE, shell=True).communicate() if err: print(err) elif out: print(out) def walkDir(dir): #!/usr/bin/env python3 import os import sys import subprocess import win32api ''' If you want use Drag and Drop, add this to the windows registry (or include into a .reg file and execute the file): Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler] @="{86C86720-42A0-1069-A2E8-08002B30309D}" ''' # Important for Drag and Drop! Change current work directory to the directory of the script os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) -
Benny Samir H revised this gist
Nov 21, 2016 . 1 changed file with 38 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,42 @@ os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) filledLength = int(round(barLength * iteration / float(total))) bar = '█' * filledLength + '-' * (barLength - filledLength) sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percent, '%', suffix)), if iteration == total: sys.stdout.write('\n') sys.stdout.flush() def process(input_filename, output_filename): if not os.path.isdir(output_dir): os.makedirs(output_dir) s = 'convert -density 200 "%s" -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray "%s"' % (input_filename, output_filename) #!/usr/bin/env python3 import os import sys import subprocess import win32api ''' If you want use Drag and Drop, add this to the windows registry (or include into a .reg file and execute the file): Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler] @="{86C86720-42A0-1069-A2E8-08002B30309D}" ''' # Important for Drag and Drop! Change current work directory to the directory of the script os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) @@ -79,7 +115,7 @@ def main(): if os.path.isdir(arg): print("Processing Directory: "+arg) walkDir(arg) elif os.path.isfile(arg) and arg.endswith(".pdf"): print("Processing single File: "+arg) process(arg, output_dir + os.path.basename(arg)) else: @@ -92,8 +128,7 @@ if __name__ == "__main__": pass except Exception as e: print(e) input() ``` ### PowerShell -
Benny Samir H revised this gist
Nov 21, 2016 . 1 changed file with 73 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,26 +19,81 @@ $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf ```python #!/usr/bin/env python3 import os import sys import subprocess import win32api ''' If you want use Drag and Drop, add this to the windows registry (or include into a .reg file and execute the file): Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler] @="{86C86720-42A0-1069-A2E8-08002B30309D}" ''' # Important for Drag and Drop! Change current work directory to the directory of the script os.chdir(os.path.abspath( os.path.dirname(os.path.realpath(__file__)))) default_input_dir = os.path.abspath('input')+"\\" output_dir = os.path.abspath('output')+"\\" def printProgress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100): formatStr = "{0:." + str(decimals) + "f}" percent = formatStr.format(100 * (iteration / float(total))) filledLength = int(round(barLength * iteration / float(total))) bar = '█' * filledLength + '-' * (barLength - filledLength) sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percent, '%', suffix)), if iteration == total: sys.stdout.write('\n') sys.stdout.flush() def process(input_filename, output_filename): if not os.path.isdir(output_dir): os.makedirs(output_dir) s = 'convert -density 200 "%s" -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray "%s"' % (input_filename, output_filename) err, out = subprocess.Popen(s, stdout=subprocess.PIPE, shell=True).communicate() if err: print(err) elif out: print(out) def walkDir(dir): for root, dirs, files in os.walk(dir): files = list(filter(lambda x: x.endswith(".pdf"), files)) i = 0; printProgress(i, len(files), prefix = 'Progress:', suffix = 'Complete', barLength = 50) for file in files: process(os.path.join(root, file), str(output_dir + file)) i += 1 printProgress(i, len(files), prefix = 'Progress:', suffix = 'Complete', barLength = 50) def main(): if len(sys.argv) == 1: print("Process default Input-Directory: "+default_input_dir) walkDir(default_input_dir) else: for arg in sys.argv[1:]: arg = os.path.abspath(arg) if os.path.isdir(arg): print("Processing Directory: "+arg) walkDir(arg) elif arg.endswith(".pdf"): print("Processing single File: "+arg) process(arg, output_dir + os.path.basename(arg)) else: print("Unknown Path-Type!") if __name__ == "__main__": try: main() except KeyboardInterrupt: pass except Exception as e: print(e) finally: input("\nPress any key to exit...") ``` ### PowerShell -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf - **-compress:** set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress) - **-colorspace:** set color to gray ## Batch-Scripts ### Python 3 ```python #!/usr/bin/env python3 -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Simulate a scanned PDF with ImageMagick 1. Download and install [ImageMagick + Convert Module](https://www.imagemagick.org/script/binary-releases.php) 2. Execute the following command in the console (change the filename) ``` $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf ``` -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -39,4 +39,22 @@ for root, dirs, files in os.walk(input_dir): print(err) elif out: print(out) ``` ### PowerShell ```powershell $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition $input_directory = $scriptPath + "\Input\" $output_directory = $scriptPath + "\Output\" New-Item -ItemType Directory -Force -Path $output_directory $files = Get-ChildItem $input_directory -Filter *.pdf ForEach ($file in $files) { "Process: " + $file.Name $command = "convert -density 200 '" + $input_directory + $file.Name + "' -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray '" + $output_directory + $file.Name + "'" Invoke-Expression -command $command } ``` -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,9 +15,9 @@ $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf - **-colorspace:** set color to gray ## Batch-Scripte ### Python 3 ```python #!/usr/bin/env python3 import os import subprocess @@ -32,5 +32,11 @@ for root, dirs, files in os.walk(input_dir): input_filename = os.path.join(root, file) print ("Process: " + input_filename) p = subprocess.Popen( 'convert -density 200 '+input_filename+' -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray '+str(output_dir + file), stdout=subprocess.PIPE, shell=True) err, out = p.communicate() if err: print(err) elif out: print(out) ``` -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf ## Batch-Scripte ### Python (2.7) ```python from __future__ import print_function import os import subprocess -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 24 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,36 @@ # Simulate a scanned PDF with ImageMagick 1. Download and install [ImageMagick + Convert Module](https://www.imagemagick.org/script/binary-releases.php) 2. Execute the following command in the console ``` $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf ``` ## Description of the options - **-density:** set the input DPI to 200 - **-rotate:** set Page rotation to 0.3 degrees - **+noise:** add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) - **-format:** set format to PDF for the correct sizing (A4) - **-quality:** set JPEG Quality to 85% - **-compress:** set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress) - **-colorspace:** set color to gray ## Batch-Scripte ### Python (2.7) ``` from __future__ import print_function import os import subprocess input_dir = "Input/" output_dir = "Output/" if not os.path.exists(output_dir): os.makedirs(output_dir) for root, dirs, files in os.walk(input_dir): for file in files: if file.endswith(".pdf"): input_filename = os.path.join(root, file) print ("Process: " + input_filename) p = subprocess.Popen( 'convert -density 200 '+input_filename+' -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray '+str(output_dir + file), shell=True) ``` -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ 1. Download and install ImageMagick + Convert Module 2. Execute the following command in the console ``` $ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf ``` ### Description of the options -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,10 @@ $ convert -density 200 INPUT-FILENAME -rotate 0.3 +noise Multiplicative -format ``` ### Description of the options - **-density:** set the input DPI to 200 - **-rotate:** set Page rotation to 0.3 degrees - **+noise:** add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) - **-format:** set format to PDF for the correct sizing (A4) - **-quality:** set JPEG Quality to 85% - **-compress:** set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress) - **-colorspace:** set color to gray -
Benny Samir H revised this gist
Nov 18, 2016 . No changes.There are no files selected for viewing
-
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,11 @@ # Simulate a scanned PDF with ImageMagick 1. Download and install ImageMagick + Convert Module 2. Execute the following command in the console ``` $ convert -density 200 INPUT-FILENAME -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray OUTPUT-FILENAME ``` ### Description of the options - -density set the input DPI to 200 - -rotate set Page rotation to 0.3 degrees - +noise add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) -
Benny Samir H revised this gist
Nov 18, 2016 . 2 changed files with 12 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ Download and install ImageMagick + Convert Module ``` $ convert -density 200 INPUT-FILENAME -rotate 0.3 +noise Multiplicative -format pdf -quality 85 -compress JPEG -colorspace gray OUTPUT-FILENAME ``` - -density set the input DPI to 200 - -rotate set Page rotation to 0.3 degrees - +noise add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) - -format set format to PDF for the correct sizing (A4) - -quality set JPEG Quality to 85% - -compress set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress) - -colorspace set color to gray -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,9 @@ :: Download and install ImageMagick + Convert Module convert -density 300 INPUT-FILENAME -rotate 0.3 +noise Multiplicative -resample 200 -quality 85 -compress JPEG -colorspace gray OUTPUT-FILENAME :: -density set the input DPI to 300 :: -rotate set Page rotation to 0.3 degrees :: +noise add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) :: -resample set the output DPI to 200 :: -quality set JPEG Quality to 85% -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ :: Download and install ImageMagick + Convert Module convert -density 300 INPUT-FILENAME -rotate 0.3 -compose divide -linear-stretch 5%x0% +noise Multiplicative -resample 200 -quality 85 -compress JPEG -colorspace gray OUTPUT-FILENAME :: -density set the input DPI to 300 :: -rotate set Page rotation to 0.3 degrees @@ -9,4 +9,5 @@ convert -density 300 INPUT-FILENAME -rotate 0.3 -compose divide -linear-stretch :: +noise add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) :: -resample set the output DPI to 200 :: -quality set JPEG Quality to 85% :: -compress set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress) :: -colorspace set color to gray -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,12 @@ :: Download and install ImageMagick + Convert Module convert -density 300 INPUT-FILENAME -rotate 0.3 -compose divide -linear-stretch 5%x0% +noise Multiplicative -resample 200 -quality 85 -compress JPEG OUTPUT-FILENAME :: -density set the input DPI to 300 :: -rotate set Page rotation to 0.3 degrees :: -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) :: +noise add noise to the PDF (other Noise-Options: https://www.imagemagick.org/script/command-line-options.php#noise) :: -resample set the output DPI to 200 :: -quality set JPEG Quality to 85% :: -compress set compress to jpeg (other Compress-Options: https://www.imagemagick.org/script/command-line-options.php#compress) -
Benny Samir H revised this gist
Nov 18, 2016 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,9 @@ 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) -
Benny Samir H created this gist
Nov 18, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ convert -density 300 INPUT-FILENAME -resample 200 +noise Multiplicative -quality 85 -compose divide -linear-stretch 5%x0% -rotate 0.3 -compress jpeg OUTPUT-FILENAME