GIMP:Script-Fu-script error

431 views Asked by At

I try batch-processing some files with GIMP.

Here is the script:

(define (script-fu-batch-sofu globexp)
(define (sofu-trans-img n f)
(let* ((fname (car f))
(img (car (gimp-file-load 1 fname fname))))
(gimp-image-undo-disable img)
(gimp-fuzzy-select (car (gimp-image-get-active-drawable img)) 0 0 10 2 FALSE FALSE 0 FALSE)
(gimp-selection-grow img 1)
(gimp-edit-clear (car (gimp-image-get-active-drawable img)))
(file-png-save-defaults non-interactive img (car (gimp-image-get-active-drawable img)) fname fname)

(gimp-image-delete img)
)
(if (= n 1) 1 (sofu-trans-img (- n 1) (cdr f)))
)
(set! files (file-glob globexp 0))
(sofu-trans-img (car files) (car (cdr files)))
)

; Im GIMP und im Menü registrieren
(script-fu-register "script-fu-batch-sofu"
  _"_Mehrere Bilder transparentieren…"
  _"Mehrere Bilder auf einmal transparent machen"
  "Martin Weber"
  "2012, Martin Weber"
  "Sep 5, 2012"
  ""
  SF-STRING "Zu transparentierende Dateien" "/pfad/zu/bildern/*.bmp")
(script-fu-menu-register "script-fu-batch-sofu" "<Image>/Xtns/Misc")

I basically copied a script from a tutorial and modified the lines where the image is processed. If i run the script, i get this error message:

Error: set!: unbound variable: files

To be honest, i don't really know what that part does, but i think i need it. I guess it opens the Files given by the script-parameter and precesses them one after the other. I just don't know what is wrong there. What did i miss?

1

There are 1 answers

3
Firzen On

I think that you need to add

(define files)

at the first line of your code.