starting from a script posted on this list I wrote the one below that
applies colorize tool to a group of files. The script can be called from
the menu, but when I try to run it a second time, the item in the menu
becomes grey and I have to refresh the scripts to run it again.
Someone can help me to find the problem?
Thanks, J.

;; batch-convert-colorize.scm  --  convert a set of files to index
;; simple batch script for GIMP 2.2
;; call it from the command-line using a line like the following:
;; gimp -i -b "(script-fu-batch-convert-index \"/home/user/images\" \"/*.png\" 
180 50 0 )" "(gimp-quit 0)"
;; or from menu xtns -> script-fu -> Batch -> Colorize

(define (script-fu-batch-colorize dir pat_file hue saturation lightness)
  (set! pattern (string-append dir pat_file))
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while filelist
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE filename 
                  (drawable (car (gimp-image-get-active-layer image))))
                  (gimp-colorize drawable hue saturation lightness)
                  (gimp-file-save RUN-NONINTERACTIVE image drawable filename 
                  (gimp-image-delete image))
             (set! filelist (cdr filelist)))))
(script-fu-register "script-fu-batch-colorize"
                    "Colorize a set of files"
                    SF-DIRNAME       _"Directory with files"       
                    SF-STRING        _"Pattern (put a / before it)"        
                    SF-ADJUSTMENT    _"Hue"        '(180 0 360 1 10 0 0)
                    SF-ADJUSTMENT    _"Saturation"        '(50 0 100 1 10 0 0)
                    SF-ADJUSTMENT    _"Lightness"        '(0 -100 100 1 10 0 0)
(script-fu-menu-register "script-fu-batch-colorize"

Gimp-user mailing list

Reply via email to