I want to sample colorize a lot (a few hundred) of black-and-white
images (scanned from negative and retouched and so on). I would like
to avoid doing it manually, so I searched and I discovered the batch
mode of the Gimp. I had a Scheme class about 15 years ago, and it
looks like I still remembered something.

With some help of some examples found on the net and the Gimp help, I
wrote the script:

(define (maarten-tiff-jpeg pattern
  (let* ((filelist (cadr (file-glob pattern 1)))
         (sampleimage (car (gimp-file-load RUN-NONINTERACTIVE
samplefilename samplefilename)))
         (sampledrawable (car (gimp-image-get-active-layer sampleimage))))
    (while (not (null? filelist))
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
             (set! drawable (car (gimp-image-get-active-layer image)))
             (plug-in-sample-colorize RUN-NONINTERACTIVE image
drawable sampledrawable TRUE TRUE FALSE TRUE 0 255 1.0 0 255)
             (set! fileparts (strbreakup filename "."))
             (set! fileparts (butlast fileparts))
             (set! filenamejpeg (string-append (unbreakupstr fileparts
".") ".jpg"))
             (gimp-file-save RUN-NONINTERACTIVE image drawable
filenamejpeg filenamejpeg)
             (gimp-image-delete image))
           (set! filelist (cdr filelist)))
    (gimp-image-delete sampleimage)))

And it seems to work fine, except for the plug-in-sample-colorize
call. So it reads the tiff file and writes a jpeg file. I also tried
to explicitly convert the grayscale image to rgb before the
plug-in-sample-colorize call, but it doesn't really help (well, the
resulting jpeg file is a black and white rgb image in that case, so
the command is actually executed, but it is still not

Anybody any idea what I'm doing wrong?

Gimp-user mailing list

Reply via email to