Skip to content

Instantly share code, notes, and snippets.

@lbell
Forked from dbuscombe-usgs/fix
Last active June 7, 2021 22:13
Show Gist options
  • Select an option

  • Save lbell/1b00e588d6007f13a25f2be134068b60 to your computer and use it in GitHub Desktop.

Select an option

Save lbell/1b00e588d6007f13a25f2be134068b60 to your computer and use it in GitHub Desktop.
Batch GIMP script for auto-sharpen, white-balance and colour enhance
; Run with: gimp -i -b '(batch-auto-fix "*.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
(define (batch-auto-fix pattern
radius
amount
threshold)
(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))))
(plug-in-unsharp-mask RUN-NONINTERACTIVE
image drawable radius amount threshold)
(gimp-levels-stretch drawable)
(plug-in-color-enhance RUN-NONINTERACTIVE
image drawable)
(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