Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script based on GIMP batch tutorial:

  (define (batch-colorize pattern
                              hue
                              saturation
                              lightness)
  (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))))
             (gimp-colorize drawable
                            hue saturation lightness)
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist)))))

So now in the folder with my images with cmd I run:

SET gimpEXE="C:\Program Files\GIMP 2\bin\gimp-2.8.exe"

%gimpEXE% -i -b "(batch-colorize *.png 90 73 15)" -b "(gimp-quit 0)";

But then GIMP says:

batch command experienced an execution error:

Error: ( : 1) eval: unbound variable: *.png

So then I tried:

%gimpEXE% -i -b "(batch-colorize ""*.png"" 90 73 15)" -b "(gimp-quit 0)";

But then GIMP says:

GIMP-Error: Failed to open file C:\myfolder\with\png\90: No such file or directory

GIMP-Error: Failed to open file C:\myfolder\with\png\73: No such file or directory

GIMP-Error: Failed to open file C:\myfolder\with\png\15: No such file or directory

GIMP-Error: Failed to open file C:\myfolder\with\png\0: No such file or directory

So then I tried what was in an original example (witch I assume is for Linux):

%gimpEXE% -i -b '(batch-colorize "*.png" 90 73 15)' -b '(gimp-quit 0)'

But then GIMP says all above and:

GIMP-Error: Failed to open file "C:\myfolder\with\png*.png": Unable to open "C:\myfolder\with\png*.png" for reading: Invalid argument

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You're assuming that the OS is going to expand the *.png for you, but since it's buried inside the quoted string for the command line argument, the expansion won't happen. This should fix the issue:

SET gimpEXE="C:\Program Files\GIMP 2\bin\gimp-2.8.exe"
for %%i in (*.png) do %gimpEXE% -i -b "(batch-colorize %%i 90 73 15)" -b "(gimp-quit 0)"

Note that the %%i is only necessary if this is contained in a batch file. If you're running the command directly at the prompt, %i is required instead.

share|improve this answer
    
Actually I was hoping GIMP would expand *.png. Eventually I used the same (original) command to parse those files, but in GIMP console. But I guess both ways work. –  Nux Sep 26 '13 at 0:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.