Hello everyone, As a user of GIMP 2.10, I am at the moment very interested by the possibilities to do batch processing with script-fu in GIMP.
So I found this page and took a close look at it: https://www.gimp.org/tutorials/Basic_Batch/ My problem is that I want to save a processed file with a new name. So it didn't take me too much time to figure out how to do it for the first example - and I came up with this: (define (simple-unsharp-mask filename radius amount threshold filenamenew) (let* ((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 filenamenew filenamenew) (gimp-image-delete image))) The procedure is being called with this command line: gimp -i -b '(simple-unsharp-mask "foo.png" 5.0 0.5 0 "foo-new.png")' -b '(gimp-quit 0)' Now I'm wondering how to get the second example, the actual batch processing script, to give new names for each and everyone of the processed images. I tried with this: (define (batch-unsharp-mask pattern radius amount threshold patternnew) (let* ((filelist (cadr (file-glob pattern 1))) (filelistnew (cadr (file-glob patternnew 1)))) (while (not (null? filelist)) (let* ((filename (car filelist)) (filenamenew (car filelistnew)) (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 filenamenew filenamenew) (gimp-image-delete image)) (set! filelist (cdr filelist)) (set! filelistnew (cdr filelistnew))))) But this didn't work because a list may not be empty: I understand now that it must exist beforehand and have at least 2 elements ("pair"). Then I tried with this: (define (batch-unsharp-mask pattern radius amount threshold filenamenew) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist)) (let* ((filename (car filelist)) (filenamenew (+ "(car filelist)" "-new")) (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 filenamenew filenamenew) (gimp-image-delete image)) (set! filelist (cdr filelist))))) But that didn't work either, because the argument to " + " (sum) must be a number. Where am I mistaken? Could you help? Or should I proceed in a totally different direction? Thanks a lot in advance. Ludo _______________________________________________ gimp-user-list mailing list List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list List archives: https://mail.gnome.org/archives/gimp-user-list