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
  Request for script chlebna 1 138 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 196 Sep 4, 2017 08:51
Last Post: ythgilb
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 192 Aug 31, 2017 14:32
Last Post: Bertholomäus
  How to modify this script-fu? Zakary81 1 156 Aug 23, 2017 12:48
Last Post: paynekj
  Need help in running a gui script-fu via command line eyalzek 2 323 Oct 4, 2014 14:05
Last Post: eyalzek

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS