Skip to content

Instantly share code, notes, and snippets.

@asdfman
Created April 29, 2012 08:16
Show Gist options
  • Save asdfman/2544576 to your computer and use it in GitHub Desktop.
Save asdfman/2544576 to your computer and use it in GitHub Desktop.
Simple GIMP script for applying filters to an entire batch of (Shimeji) images.
; Simple GIMP script for batch filter operations. Will retain transparency. Intended input image format is PNG.
; Made this for the purpose of adding drop shadows and other filters to Shimeji imagesets. Save this file
; to ~/.gimp scripts/ . Execute in the directory containing the images you wish to modify :
; gimp-console -b '(batch-drop-shadow "*.png" 0 0 4)' -b '(gimp-quit 0)'
; Where 0 0 4 is the x offset, y offset and the radius for the drop shadow.
; For more information on how to apply other filters, check out Filters -> Script-Fu -> Console -> Browse in GIMP
(define (batch-drop-shadow pattern
offsetx
offsety
radius)
(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))))
; Modify the stuff below, add/remove filters
(plug-in-cartoon RUN-NONINTERACTIVE image drawable 3.0 0.1)
(script-fu-drop-shadow image drawable offsetx offsety radius '(0 0 0) 60.0 FALSE)
; Modify above
(set! drawable (car (gimp-image-merge-visible-layers image TRUE)))
(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