(define (add-white-background filename)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-context-set-background '(255 255 255))
(gimp-layer-flatten drawable)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
(define (batch-add-white-background pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let ((filename (car filelist)))
(add-white-background filename))
(set! filelist (cdr filelist)))))