Skip to content

Instantly share code, notes, and snippets.

@patrickward
Last active April 15, 2022 12:47
Show Gist options
  • Select an option

  • Save patrickward/7804465 to your computer and use it in GitHub Desktop.

Select an option

Save patrickward/7804465 to your computer and use it in GitHub Desktop.
Batching the selective blur filter in Gimp
;; Batch processes all files within the current directory
;; by running a selective blur on each image and then saving them
;; WARNING: edits the original file. Run this on copies of the original images.
;;
;; Save the script below in the local gimp scripts directory
;; (e.g. ~/.gimp-2.8/scripts/batch-selective-blur.scm)
;;
;; Example execution:
;; gimp -i -b '(batch-selective-blur "*.jpg" 6.0 31)' -b '(gimp-quit 0)'
;;
(define (batch-selective-blur pattern
radius
maxdelta)
(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-sel-gauss RUN-NONINTERACTIVE
image
drawable
radius
maxdelta)
(gimp-file-save RUN-NONINTERACTIVE
image
drawable
filename
filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
@robboh
Copy link

robboh commented Apr 15, 2022

Hi, how to put in the file list?

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