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
  Run script on action rchav 2 904 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 581 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 11,674 Jul 17, 2018 16:01
Last Post: paynekj
  Problems with a bat script :( ThaUnknown_ 1 529 Mar 26, 2018 21:14
Last Post: paynekj
  Script-fu ordered file list vnicent 1 345 Mar 19, 2018 17:33
Last Post: paynekj

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS