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
  Problems with a bat script :( ThaUnknown_ 1 301 Mar 26, 2018 21:14
Last Post: paynekj
  Script-fu ordered file list vnicent 1 142 Mar 19, 2018 17:33
Last Post: paynekj
  script-fu argument/parameter formats dhugg 2 242 Mar 13, 2018 00:50
Last Post: dhugg
  Request for script chlebna 1 401 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 466 Sep 4, 2017 08:51
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS