Last active
May 7, 2017 15:33
-
-
Save oshenc/5f0a8933df9c0f657cebe9cbe3aef791 to your computer and use it in GitHub Desktop.
A batch for the gimp editor that makes scanned image perfect for me
This file contains 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
;; ~/.gimp-2.8/scripts/perfectize.scm | |
;; usage: gimp -i -b '(batch-perfectize "*.jpg")' -b '(gimp-quit 0)' | |
define (batch-perfectize pattern) | |
(let* ((filelist (cadr (file-glob pattern 1)))) | |
(while (not (null? filelist)) | |
(let* ((filename (car filelist)) | |
(image (car (gimp-file-load RUN-NONINTERACTIVE | |
filename filename))) | |
(drawable (car (gimp-image-get-active-layer image)))) | |
(gimp-levels drawable 0 100 230 1.00 0 255) | |
(gimp-file-save RUN-NONINTERACTIVE | |
image drawable filename filename) | |
(gimp-image-delete image)) | |
(set! filelist (cdr filelist))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment