curves spline batch
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
curves spline batch | Decimator Doseven | 10 Feb 15:55 |
curves spline batch | saulgoode@flashingtwelve.brickfilms.com | 10 Feb 18:58 |
curves spline batch | Niels Giesen | 10 Feb 19:54 |
curves spline batch | Decimator Doseven | 10 Feb 22:23 |
curves spline batch | Sven Neumann | 10 Feb 23:11 |
curves spline batch | Decimator Doseven | 11 Feb 16:55 |
curves spline batch | monty | 10 Jun 09:30 |
curves spline batch
I am attempting to set up a batch that automatically runs gimp-curves-spline on a set of images. However, I have never used Scheme before and therefore am not sure why my script is returning "batch command experienced an execution error"
Here is the command I am using to call the script(via a windows .bat file)
gimp-2.6.exe -i --verbose -b "(color-curve \"C:\\gimpbatchtest\\*.tiff\")" -b "(gimp-quit 0)"
And the script itself:
(define (color-curve pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-curves-spline RUN-NONINTERACTIVE image HISTOGRAM-VALUE 3 '(0 0 64 200 128 46))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
Any help will be greatly appreciated, thank you.
-Byron
curves spline batch
Quoting Decimator Doseven :
I am attempting to set up a batch that automatically runs gimp-curves-spline on a set of images. However, I have never used Scheme before and therefore am not sure why my script is returning "batch command experienced an execution error" :
:
(gimp-curves-spline RUN-NONINTERACTIVE image HISTOGRAM-VALUE 3 '(0 0 64 200 128 46))
Unfortunately, you cannot just pass a list of values to the 'gimp-curves-spline' PDB function; you must pass that list as an array of 8-bit values.
You can create such an array with code similar to the following
(let* (
(my-curve (cons-array 6 'byte))
)
(aset! my-curve 0 0)
(aset! my-curve 1 0)
(aset! my-curve 2 64)
(aset! my-curve 3 200)
(aset! my-curve 4 128)
(aset! my-curve 5 46)
(gimp-curves-spline RUN-NONINTERACTIVE image
HISTOGRAM-VALUE 3 my-curve)
)
curves spline batch
On Tue, Feb 10, 2009 at 6:58 PM,
wrote:
Quoting Decimator Doseven :
I am attempting to set up a batch that automatically runs gimp-curves-spline on a set of images. However, I have never used Scheme before and therefore am not sure why my script is returning "batch command experienced an execution error" :
:
(gimp-curves-spline RUN-NONINTERACTIVE image HISTOGRAM-VALUE 3 '(0 0 64 200 128 46))Unfortunately, you cannot just pass a list of values to the 'gimp-curves-spline' PDB function; you must pass that list as an array of 8-bit values.
You can create such an array with code similar to the following
(let* ( (my-curve (cons-array 6 'byte)) )
(aset! my-curve 0 0)
(aset! my-curve 1 0)
(aset! my-curve 2 64)
(aset! my-curve 3 200)
(aset! my-curve 4 128)
(aset! my-curve 5 46)
(gimp-curves-spline RUN-NONINTERACTIVE image HISTOGRAM-VALUE 3 my-curve) )
Maybe byte-arrays where stored differently in earlier versions (I do not know), but it seems to me they are stored as vectors in GIMP 2.6.4, so is there any reason not use a literal vector (as in #(0 0 64 200 128 46)):
(equal? #(0 0 64 200 128 46)
(let ((my-curve (cons-array 6 'byte)))
(aset my-curve 0 0)
(aset my-curve 1 0)
(aset my-curve 2 64)
(aset my-curve 3 200)
(aset my-curve 4 128)
(aset my-curve 5 46)))
=> #t
Just wondering, Niels.
curves spline batch
Ok, I have made progress. It appears that Gimp 2.6 does not like "aset!", so I had to change it to "vector-set!" to make gimp take it. Note this page stating that "aset" was deprecated back in gimp 2.4: http://www.gimp.org/docs/script-fu-update.html
Script-fu gives me much better error messages. With my current script, I get this response, which I think means null: ()
The image does not appear to have been modified at all, so there is still something wrong.
Currently, I am using this line, via script-fu, to run my script:
(color-curve "C:\\gimpbatchtest\\*.tiff")
And the script itself:
(define (color-curve pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(let* (
(my-curve (make-vector 6 'byte))
)
(vector-set! my-curve 0 0)
(vector-set! my-curve 1 0)
(vector-set! my-curve 2 208)
(vector-set! my-curve 3 17)
(vector-set! my-curve 4 255)
(vector-set! my-curve 5 255)
(gimp-curves-spline image
HISTOGRAM-VALUE 6 my-curve)
)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
Thanks in advance.
-Byron
curves spline batch
Hi,
On Tue, 2009-02-10 at 13:23 -0800, Decimator Doseven wrote:
(gimp-curves-spline image
HISTOGRAM-VALUE 6 my-curve)
You are passing the image ID to the gimp-curves-spline procedure but it expects the drawable ID.
Sven
curves spline batch
----- Original Message ----
From: Sven Neumann
To: Decimator Doseven
Cc: gimp-user@lists.XCF.Berkeley.EDU
Sent: Tuesday, February 10, 2009 4:11:21 PM
Subject: Re: [Gimp-user] curves spline batch
On Tue, 2009-02-10 at 13:23 -0800, Decimator Doseven wrote:
(gimp-curves-spline image
HISTOGRAM-VALUE 6 my-curve)
You are passing the image ID to the gimp-curves-spline procedure but it expects the drawable ID.
The script is now working. I fixed the issue you mentioned, and also found that I needed to change the command I was using to call the script.
The windows batch command I am using to call the script is now: gimp-console-2.6.exe -i --verbose -b "(color-curve \"C:\\gimpbatchtest\\*.tiff\")" -b "(gimp-quit 0)"
And the script itself:
(define (color-curve pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(write filename)
(drawable (car (gimp-image-get-active-layer image))))
(let* (
(my-curve (make-vector 6 'byte))
)
(vector-set! my-curve 0 0)
(vector-set! my-curve 1 0)
(vector-set! my-curve 2 208)
(vector-set! my-curve 3 17)
(vector-set! my-curve 4 255)
(vector-set! my-curve 5 255)
(gimp-curves-spline drawable
HISTOGRAM-VALUE 6 my-curve)
)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
Again, thanks for all the help, I was utterly clueless before.
-Byron
- postings
- 2
curves spline batch
----- Original Message ----
From: Sven Neumann
To: Decimator Doseven
Cc: gimp-user@lists.XCF.Berkeley.EDU Sent: Tuesday, February 10, 2009 4:11:21 PM Subject: Re: [Gimp-user] curves spline batch
On Tue, 2009-02-10 at 13:23 -0800, Decimator Doseven wrote:
(gimp-curves-spline image
HISTOGRAM-VALUE 6 my-curve)
You are passing the image ID to the gimp-curves-spline procedure but it expects the drawable ID.
The script is now working. I fixed the issue you mentioned, and also found that I needed to change the command I was using to call the script.
The windows batch command I am using to call the script is now: gimp-console-2.6.exe -i --verbose -b "(color-curve \"C:\\gimpbatchtest\\*.tiff\")" -b "(gimp-quit 0)"
And the script itself:
(define (color-curve pattern)
(let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist))
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (write filename)
(drawable (car (gimp-image-get-active-layer image)))) (let* (
(my-curve (make-vector 6 'byte)) )
(vector-set! my-curve 0 0) (vector-set! my-curve 1 0) (vector-set! my-curve 2 208) (vector-set! my-curve 3 17) (vector-set! my-curve 4 255) (vector-set! my-curve 5 255) (gimp-curves-spline drawable HISTOGRAM-VALUE 6 my-curve) )
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image)) (set! filelist (cdr filelist)))))
Again, thanks for all the help, I was utterly clueless before.
-Byron
Hello friends,
I have many images amd I want to apply a curve to all these images in Gimp. How to do that? Please help me.. Thanks.