10

So i tried to run the batch code from this tutorial: http://www.gimp.org/tutorials/Basic_Batch/

I copied and saved this to the .gimp-2.8 scripts folder

  (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)))))

And ran the command:

gimp-2.8 -i -b '(batch-unsharp-mask "*.png" 5.0 0.5 0)' -b '(gimp-quit 0)'

But i get the error

Error: ( : 1) eval: unbound variable: *.png

This doesn't seem to be a problem with the script; probably the way i am calling it or i am missing something but i cant figure it out.

Joe Staines
  • 301
  • 1
  • 3
  • 11

5 Answers5

3

I know it's been four long months, but I was just fighting with a gimp (2.8) script I had written and getting a recurring

batch command experienced an execution error:
Error: ( : 32578) eval: unbound variable: while 

It turns out that, in my haste to consolidate script directories, I had removed the reference to /usr/share/gimp/2.0/scripts. Apparently there's something in that directory that defines "while"

Edit->Preferences->Folders->Scripts

mmrtnt
  • 382
  • 1
  • 8
1

Got the original script working in gimp 2.8 ubuntu 14.04lts Just had to copy and paste the line breaks back together. I am having trouble pasting this in so the lines are not broken, just remove the blank lines as they are a posting anomaly. Place script in ~/.gimp-2.9/scripts Using this to remove haze run as gimp -i -b '(batch-unsharp-mask "*.JPG" 100 0.3 0)' -b '(gimp-quit 0)'

(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)))))
mccbala
  • 183
  • 1
  • 7
Aaron
  • 19
  • 1
0

I resolved this error by confirming the name of my script. I copied my script from an existing script and the name was duplicate. After I updated the name of my script the error went away and everything started working.

You must have unique script names, that includes the define name

Skye Hoefling
  • 180
  • 1
  • 9
0

What helped me was making sure that the script had the correct extension, .scm.

dayer4b
  • 978
  • 14
  • 26
0

Had the same problem with a similar batch script. The only way I was able to make it work was to remove the pattern from the command line entirely and hard code it in the script itself.

This is what worked for me:

from:

(define (batch-c2c pattern)
(let* ((filelist (cadr (file-glob pattern 1))))

to:

(define (batch-c2c)
(let* ((filelist (cadr (file-glob "*.png" 1))))

command line: gimp-2.10 -i -b "(batch-c2c)" -b "(gimp-quit 0)"