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

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


Hi, Kevin -
With all due respect, I thought my formatting was a a lot more liberal than
most of the sample Script-Fu code I've seen on my last several days with
Scheme.  Nevertheless, your point was very well taken - and you were 100%
correct about the placement of the "set!".  The "file-glob" part of the
script now works, and I'm successfully able to iterate through my files.
Thank you!!!!
Unfortunately, it doesn't yet seem to be converting my .png files from RGBA
to Indexed: the end files are still RGBA.  So I've still got some debugging
ahead ;-)
In the meantime, I'd definitely appreciate any suggestions/comments on my
current indentation style.
Thank you again!
Sincerely .. PSM


From: script-fu@xxxxxxxxxxxxxxx [mailto:script-fu@xxxxxxxxxxxxxxx] On Behalf
Of Kevin Cozens
Sent: Monday, January 09, 2006 9:20 AM
To: script-fu@xxxxxxxxxxxxxxx
Subject: Re:  Script-fu newbie: need to batch-convert files to
indexed color

paulsm1021 wrote:
> The script is below.  Any idea what I'm doing wrong?????
> (define (script2-test pattern)
>   (let* ((filelist (cadr (file-glob pattern 1))))
>     (while filelist
>              (gimp-image-delete image))
>            (set! filelist (cdr filelist))))

I would encourage anyone writing Scheme based scripts to format the scripts 
like they would format most other scripts or programming language rather. 
In other words, don't end a line with a massive collection of ). All those 
closing ) may save space on printouts but makes it much harder to see if 
you have the right number of them and if they are in the right places.

Due to the way you formatted the script you didn't notice that the 'set! 
filelist' statement at the end of the script is in the wrong place. It 
should be the last line of the while loop but it is currently after the

The last two lines should be
              (gimp-image-delete image)
            (set! filelist (cdr filelist)))))
to use the formatting style of your original script.

I haven't tried running the script so there might still be other problems 
with it.




; 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);
  (cvt-to-indexed pattern)
    (while filelist
            (car filelist)
              filename filename)
           (set! filelist 
             (cdr filelist)
  "Convert RGB to Indexed"
  "January 8, 2006"
  SF-STRING "pattern" "../../proj/hbaview/data/gimp_scaled/*.png")

[Non-text portions of this message have been removed]

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