/me looks at the speechless monks...
Here's the example script that I used in the column.
It's not great code, but I had time and space limitations
that were kicking my ass, but enough excuses... It shows
a little Perl being embedded inside a Scheme script, and
that's all that counts for now.
create-thumbnail.scm
#!/usr/bin/env gimp-request
(begin
; This is a helper function that puts
; the contents of @ARGV into the
; Scheme variable, argv.
{set_argv}
; This uses perl's regexes to create
; filenames for the thumbnails. Doing
; this in Scheme would be harder.
(set!
outfiles
'{ sexp_from_list( map { s/\..*$/-thumbnail.png/; $_ } @ARGV) })
; configure your scaling factor
(set! scale 0.30)
; This is a function for resizing and saving images
(define (resize filename)
(let*
((image (car (gimp-file-load 0 filename filename)))
(drawable nil)
(wd (car (gimp-image-width image)))
(hi (car (gimp-image-height image)))
(_wd (* wd scale))
(_hi (* hi scale))
(new-filename nil))
(gimp-image-scale image _wd _hi)
(set! drawable (car (gimp-image-flatten image)))
(set! new-filename (car outfiles))
(set! outfiles (cdr outfiles))
(gimp-file-save 1 image drawable new-filename new-filename)
(gimp-image-delete image)
))
; Finally, make a thumbnail out of every file in argv
(for-each resize argv)
)