Post Reply 

apply palette (gpl) within an script

Dec 15, 2010, 10:58
Post: #1
apply palette (gpl) within an script

It is the firt time that I try to do a gimp script. I am doing an script that takes from a directory all tif images in gray scale mode converts to indexed mode and saves as png files. The script runs generate the png indexed images but I do not know how to apply a palette to the indexed image. I have created a palette and I added de gpl file to the gimp palette folder (is available I can use it interactively).

This is my scm script (execution: gimp -i -b '(batch-indexed "*.tif")' -b '(gimp-quit 0)'):

(define (batch-indexed pattern)

(let* ((file_l (cadr (file-glob pattern 1))))
(while (not (null? file_l))
(let* ((filename (car file_l))
(image (car (file-tiff-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image)))
(gimp-message filename)

(gimp-image-convert-indexed image 0 0 256 FALSE FALSE "SST")

(set! filename (string-append (unbreakupstr (butlast (strbreakup filename ".")) ".") ".png"))
(file-png-save RUN-NONINTERACTIVE image drawable filename filename FALSE 9 FALSE FALSE FALSE FALSE FALSE)
(gimp-image-delete image)
(set! file_l (cdr file_l))


Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help in running a gui script-fu via command line eyalzek 2 223 Oct 4, 2014 14:05
Last Post: eyalzek
  Color menuitems in script or plugin Barbie 4 378 Sep 29, 2014 09:51
Last Post: paynekj
  script-fu ok in gimp, not in commad line dominique 1 259 Sep 28, 2014 03:18
Last Post: dominique
  Script fu and Color to alpha john 4 385 Sep 20, 2014 08:46
Last Post: rich2005
  Setting text markup from python script Burbly 1 286 Sep 16, 2014 12:29
Last Post: Burbly

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS