Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script fu 'unbound variable' error on arguments

Tags:

gimp

script-fu

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.

like image 923
Joe Staines Avatar asked Mar 05 '14 23:03

Joe Staines


2 Answers

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

like image 169
mmrtnt Avatar answered Nov 14 '22 06:11

mmrtnt


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)))))
like image 25
Aaron Avatar answered Nov 14 '22 06:11

Aaron