Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ankitjaininfo
Last active August 22, 2016 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitjaininfo/86e7e07a8df12e246ce49ec0a7168716 to your computer and use it in GitHub Desktop.
Save ankitjaininfo/86e7e07a8df12e246ce49ec0a7168716 to your computer and use it in GitHub Desktop.
Gimp - Reduce ISO Noise for Photos in bulk - Run this on a directory with image files. It overwrites existing files.
; Takes a pattern and applies despeckle to reduce noise in photos.
; You can also pass ratio if you want to scale photos
;
; CAUTION - IT OVERWRITES EXISTING FILES IN THE DIRECTORY
;
; Example: gimp -i -b '(batch-despeckle "*.jpg" 0.5)' -b '(gimp-quit 0)'
(define (batch-despeckle pattern ratio)
(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)))
(cur-width (car (gimp-image-width image)))
(cur-height (car (gimp-image-height image)))
(width (* ratio cur-width))
(height (* ratio cur-height))
)
(plug-in-despeckle RUN-NONINTERACTIVE image drawable 10 3 -1 248)
(gimp-image-scale image width height)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image)
)
(set! filelist (cdr filelist)))))
; Ref 1: https://www.gimp.org/tutorials/Basic_Batch/
; Ref 2: http://www.adp-gmbh.ch/misc/tools/script_fu/ex_10.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment