'gimp-levels-stretch' in batch mode
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.
'gimp-levels-stretch' in batch mode | wwaser@web.de | 22 Mar 20:57 |
'gimp-levels-stretch' in batch mode | Sven Neumann | 22 Mar 21:02 |
'gimp-levels-stretch' in batch mode | wwaser@web.de | 22 Mar 22:15 |
'gimp-levels-stretch' in batch mode | Sven Neumann | 23 Mar 20:17 |
'gimp-levels-stretch' in batch mode
Hi,
I have used ImageMagick for batch mode treatment of images but would (have to) use gimp for certain functions.
Being completely new to the gimp script-fu, I copied an example from the intertubes
-----
(define (batch-unsharp-mask pattern
radius
amount
threshold)
(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))))
(plug-in-unsharp-mask RUN-NONINTERACTIVE
image drawable radius amount threshold)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
-----
saved it as
~/.gimp-2.6/scripts/batch-unsharp-mask.scm
and run it with
gimp -i -b '(batch-unsharp-mask "*.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
It worked.
I also found the function 'gimp-levels-stretch' in the Script-Fu Procedure Browser and tried to adapt the example script:
-----
(define (stretch-levels 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-levels-stretch RUN-NONINTERACTIVE
image drawable)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
-----
saved as 'stretch-levels.scm in ~/.gimp-2.6/scripts/ and run as
gimp -i -b '(stretch-levels "*.jpg")' -b '(gimp-quit 0)'
Does not work and prints the error message:
'batch command experienced an execution error'
I would be very much obliged for any help getting the 'gimp-levels-stretch'
function run in batch mode.
Any pointers to online instructions etc. would be appreciated.
Thanks, W.
-----
Gimp 2.6.2 on opensuse11.1
________________________
'gimp-levels-stretch' in batch mode
Hi,
On Sun, 2009-03-22 at 20:57 +0100, wwaser@web.de wrote:
I also found the function 'gimp-levels-stretch' in the Script-Fu Procedure Browser and tried to adapt the example script:
----- (define (stretch-levels 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-levels-stretch RUN-NONINTERACTIVE image drawable)
If you look more closely at the Procedure Browser, you will notice that gimp-levels-stretch only takes a single parameter, not three.
Sven
'gimp-levels-stretch' in batch mode
Thanks for the quick reply,
If you look more closely at the Procedure Browser, you will notice that gimp-levels-stretch only takes a single parameter, not three.
However, I realized that 'gimp-levels-stretch' only takes a filename as a parameter, so I removed the additional ones:
'radius, amount, threshold'
from the example script (definition & function call) and from the bash command.
So something else must be wrong.
Wolfgang
On Sunday 22 March 2009 22:02:55 you wrote:
Hi,
On Sun, 2009-03-22 at 20:57 +0100, wwaser@web.de wrote:
I also found the function 'gimp-levels-stretch' in the Script-Fu Procedure Browser and tried to adapt the example script:
----- (define (stretch-levels 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-levels-stretch RUN-NONINTERACTIVE image drawable)If you look more closely at the Procedure Browser, you will notice that gimp-levels-stretch only takes a single parameter, not three.
Sven
________________________
'gimp-levels-stretch' in batch mode
Hi,
On Sun, 2009-03-22 at 22:15 +0100, wwaser@web.de wrote:
If you look more closely at the Procedure Browser, you will notice that gimp-levels-stretch only takes a single parameter, not three.
However, I realized that 'gimp-levels-stretch' only takes a filename as a parameter, so I removed the additional ones:
filename ???
'radius, amount, threshold'
What kind of crack are you on? The script you showed us passes the three parameters RUN-NONINTERACTIVE, image and drawable to gimp-levels-stretch. And the documentation of that procedure clearly states that it only takes a drawable parameter.
Sven