Hi -

I'm new to Script-Fu, Scheme and Gimp plug-ins.  I'm running gimp 2.2.4 on SuSE 
Linux 9.3.  I've
been through all of the tutorials, and several days of trial-and-error, but I 
just can't get it to
work.

I need to write a script that converts all of the *.png files in a directory 
from RGBA to indexed
color.  All of the files need to share the *same* palette, so I'm using the 
standard "Web"
palette.  It works fine manually, but I've had no luck getting the script to 
work.

When I run it from the command line, I get this:
  gimp -i -b '(script2-test ../../proj/hbaview/data/gimp_scaled/*.png)' 
'(gimp-quit 0)'
No batch interpreter specified, using the default 'plug_in_script_fu_eval'.
batch command: experienced an execution error.

When I run it from Xtns, I get this:
 (script2-test ../../proj/hbaview/data/gimp_scaled/*.png)
ERROR: unbound variable (see errobj)

The script is below.  Any idea what I'm doing wrong?????

Thank you VERY much in advance!
============================================================
;
; Adapted from:
; - http://www.gimp.org/tutorials/Basic_Batch/
; - less gimpconvert_pdb.h =>
;     boolean gimp_image_convert_indexed
;       (gint32                  image_ID,
;        GimpConvertDitherType   dither_type,
;        GimpConvertPaletteType  palette_type,
;        gint                    num_cols,
;        gboolean                alpha_dither,
;        gboolean                remove_unused,
;        const gchar            *palette);
;
(define (script2-test pattern)
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while filelist
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
                                              filename filename)))
                  (drawable (car (gimp-image-get-active-layer image))))
                  (gimp-image-convert-indexed
                     image
                     FS-DITHER
                     MAKE-PALETTE
                     216
                     FALSE
                     FALSE
                     "Web"))
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist))))
(script-fu-register
  "script2-test"
  "script2-test"
  "Convert RGB to Indexed"
  ""
  ""
  "January 8, 2006"
  ""
  SF-STRING "pattern" "/home/paulsm/proj/hbaview/data/gimp_scaled/RocketBoy_scal
ed0001.png")

(script-fu-menu-register
  "script2-test"
  "<Toolbox>/Xtns/Script-Fu/Utils")
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to