No sorry but this does not help me with my particular error, which happens on line
(filelist
(vector-ref
(cadr
(file-glob #:pattern pattern #:filename-encoding TRUE)
)
0)
)
Where can I find information on these: vector-ref, cadr, car, file-glob ?
The error I get is
Quote:
: car: argument 1 must be: pair
Also I don't use this scm as a plugin, I run it as as batch script.
Script loads JPG files in the folder, applies an enhancement, then saves each file. Used to run it from command line like that:
gimp -i --batch-interpreter plug-in-script-fu-eval -b '(batch-levels-stretch "*.JPG")'
It used to perfectly work before, I am now contemplating to install older version of Gimp
There is no information whatsoever on how to fix it, no examples of new scripts, no documentation, Gimp 3.2 RC2 still includes folder with default old scripts which are not working, I thought if someone decides to majorly break ALL of the scripts - at least provide some examples of the new ones, at least those which are provided as part of the release?
script-fu-util.scm, part of 3.0 package, contains function with-files, which is broken with the same error.
; For example, to invert the colors of all of the PNG files in the
; start directory:
;
; gimp -i -b '(with-files "*.png" (gimp-drawable-invert layer FALSE) \
; (gimp-file-save 1 image layer filename))'
;
; To do the same thing, but saving them as jpeg instead:
;
; gimp -i -b '(with-files "*.png" (gimp-drawable-invert layer FALSE) \
; (gimp-file-save 1 image layer \
; (string-append basename ".jpg") ))'
; butlast is needed below.
; Not in R5RS but in simply-scheme and chicken dialects.
; aka drop-right.
; Returns new list with right element deleted.
(define (butlast x)
(if (= (length x) 1)
'()
(reverse (cdr (reverse x)))
)
)
(define-macro (with-files pattern . body)
(let ((loop (gensym))
(filenames (gensym))
(filename (gensym)))
`(begin
(let ,loop ((,filenames (cadr (file-glob ,pattern 1))))
(unless (null? ,filenames)
(let* ((filename (car ,filenames))
(image (catch #f (car (gimp-file-load RUN-NONINTERACTIVE
filename))))
(layer (if image (vector-ref (gimp-image-get-selected-layers image) 0) #f))
(basename (unbreakupstr (butlast (strbreakup filename ".")) ".")))
(when image
,@body
(gimp-image-delete image)))
(,loop (cdr ,filenames))
)
)
)
)
)