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:

Code:
(define (maarten-tiff-jpeg pattern
                           samplefilename)
  (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)))
                  (drawable)
                  (fileparts)
                  (filenamejpeg))
             (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
  Request for script chlebna 1 84 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 154 Sep 4, 2017 08:51
Last Post: ythgilb
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 139 Aug 31, 2017 14:32
Last Post: Bertholomäus
  How to modify this script-fu? Zakary81 1 112 Aug 23, 2017 12:48
Last Post: paynekj
  Help - can't get Mathmap and GMIC to work together paul2332 1 114 Jul 15, 2017 18:58
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS