Post Reply 

apply palette (gpl) within an script

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

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

)
)
)

Thanks
Josep
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 3 142 Oct 4, 2014 14:05
Last Post: eyalzek
  Color menuitems in script or plugin Barbie 7 276 Sep 29, 2014 10:09
Last Post: ofnuts
  script-fu ok in gimp, not in commad line dominique 3 163 Sep 28, 2014 08:55
Last Post: ofnuts
  Script fu and Color to alpha john 4 290 Sep 20, 2014 08:46
Last Post: rich2005
  Setting text markup from python script Burbly 3 206 Sep 16, 2014 13:41
Last Post: ofnuts

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS