Skip to content

Instantly share code, notes, and snippets.

@dbuscombe-usgs
Created July 26, 2013 02:57
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dbuscombe-usgs/6085758 to your computer and use it in GitHub Desktop.
Save dbuscombe-usgs/6085758 to your computer and use it in GitHub Desktop.
Batch GIMP script for auto-sharpen, white-balance and colour enhance
(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)))))
@ckolluru
Copy link

ckolluru commented Jul 25, 2020

Did you copy the script batch-auto-fix to the scripts folder in your installation of GIMP? Then you can run it by first navigating to the folder containing the script in command prompt, adding the gimp executable to your system PATH variable and then specifying the full directory path to your images in your command.

@lamanawebu
Copy link

Run with
gimp -i -b '(batch-auto-fix "*.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'

and under Windows you have to change it to
gimp -i -b "(batch-auto-fix """*.jpg""" 5.0 0.5 0)" -b "(gimp-quit 0)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment