Post Reply 

plug-in-sample-colorize seems not to work from script

Jan 24, 2011, 16:46 (This post was last modified: Jan 24, 2011 16:50 by indigo.)
Post: #1
plug-in-sample-colorize seems not to work from script
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.

So 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 not sample-colorized).

Anybody any idea what I'm doing wrong?

(edit: formatted the script)
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  PDN Plug-in for GIMP? snoopy55 11 11,720 Dec 3, 2018 09:16
Last Post: paynekj
  Run script on action rchav 2 1,352 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 903 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 14,891 Jul 17, 2018 16:01
Last Post: paynekj
  Problems with a bat script :( ThaUnknown_ 1 685 Mar 26, 2018 21:14
Last Post: paynekj

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS