Tuesday, October 2, 2007

An example of file-glob gimp script-fu function

After some attempts, I finally realize how to use:


a GIMP script-fu function.

Here, an example:

(define filesPattern)
(set! filesPattern (string-append "/home/a_dir_with_some_jpeg/" "*.jpg"))
(define arrayFilesList)
(set! arrayFilesList (file-glob filesPattern 1))

; Convert the array to a SCHEME list
(define filesList)
(define counter)
(set! counter 0)
(while (< counter (car arrayFilesList)) (set! filesList (cons (aref (cadr arrayFilesList) counter) filesList)) (set! counter (+ counter 1)) )

; Now you can use "car" and "cdr" on filesList

No comments:

Post a Comment