Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in running a simple unsharp mask batch processing script
Hi all,

I'm trying to get this simple unsharp masking batch script to work. I have many .tif files, and I'd like to unsharp mask them in one go.

I've made the scm file, copied it over into the scripts directory. This is the scm file content:

(define (batch-unsharp-mask pattern
 (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)))))

Next, I open command prompt, move to the folder with the images and run the following command:

gimp -b '(batch-unsharp-mask "*.tif" 5.0 0.5 0)' -b '(gimp-quit 0)'

Gimp does open up and all the tif files are opened one after another, but then gimp tries to load files named 5.0, 0.5 and 0. This results in an error message.

It says something like this:

Opening 'C:\Users\cxk340\for_gimp_processing\5.0' failed: No such file or directory

Any help would be appreciated. Thanks!
Pretty old tutorial that mentions Gimp 2.4. I don't see anything wrong with your code (but Scheme isn't my cup of tea). However it seems that the command line in the tutorial is Linux-ish and you are using Windows which has pretty much the opposite conventions when it comes to quoting, so try to use outer double quotes and escape the quotes around the pattern:

gimp -b "(batch-unsharp-mask \"*.tif\" 5.0 0.5 0)" -b "(gimp-quit 0)"

Forum Jump: