Script-fu newbie: need to batch-convert files to indexed color

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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
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:
; -
; - 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-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist))))
  "Convert RGB to Indexed"
  "January 8, 2006"
  SF-STRING "pattern"


Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:

<*> Your use of Yahoo! Groups is subject to:

[Index of Archives]     [Gimp Developers]     [Gimp Users]     [Yosemite News]     [Epson Inkjet Printers]     [Scanners]     [Gimp's Home]     [Steve's Art]

&hbsp; Powered by Linux