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
'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")





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/script-fu/

<*> To unsubscribe from this group, send an email to:
    script-fu-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



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

&hbsp; Powered by Linux