On my windows machine, I want to use GIMP to modify all PNG files (filename.png) in the current directory and to save the output file to the sub-directory out/filename.png. The processing that is needed is:

  • adding rounded corners
  • adding drop shadow
  • resizing the image

For that, I tried to use the following script and placed it under C:\Program files\GIMP\share\gimp\2.0\scripts:

(define (script-fu-shadowcorners infile outfile width height)
  (let* ((image (car (file-png-load 1 infile infile)))
         (drawable (car (gimp-image-active-drawable image)))
    (script-fu-round-corners image drawable 10 FALSE 8 8 30 FALSE FALSE)
    (script-fu-drop-shadow image drawable 8 8 12 '(0 0 0) 45 TRUE)
    (gimp-image-scale image width height)
    (gimp-file-save RUN-NONINTERACTIVE image drawable outfile outfile)

(script-fu-register "script-fu-shadowcorners" "" "" "" "" "" "RGB*" SF-FILENAME "Infile" "infile.png" SF-FILENAME "Outfile" "outfile.png")

Afterwards, I tried to call this script with the following batch file:

for %%x in (*.png) do "C:\Program files\GIMP\bin\gimp-2.8" -i -b "(script-fu-shadowcorners \"%%x\" \"newfolder\\%%x\")"

It did not work. It does always say it could not find the files, it's very slow, and there is no output.

Now that the CMD command works, at least, the problem is not completely solved. In CMD, there appears a line after my batch command that replaces the %%x wildcard by the first file name - but only the first. In the output directory, I can not find files other than the first one, either. Nevertheless, Gimp's output is batch command executed successfully.

What am I doing wrong? Can you help me? Thank you very much!

  • 1
    Does the command work with a single PNG specified at the command line? Ensure paths with spaces (such as to the gimp-2.8 dir) are quoted. Also, try adding an echo before "C:\Program files... in the for loop and see what's printed out. Are the paths to the PNGs ok?
    – Karan
    Jan 16, 2013 at 2:59
  • Thank you! It turned out that the correct command would have been this one-liner: for %%x in (*.png) do "C:\Program files\GIMP\bin\gimp-2.8" -i -b "(script-fu-functionname \"%%x\" \"newfolder\\%%x\")"
    – caw
    Jan 16, 2013 at 18:08
  • Unfortunately, this does only process 1 of the 24 .png files in my directory. Can anybody see why?
    – caw
    Jan 16, 2013 at 18:09
  • Any errors causing the script to abort? I'm actually getting confused by that script-fu bit - do you really need to escape the quotes with backslashes for it?
    – Karan
    Jan 16, 2013 at 18:10
  • 2
    If you run it at the command-line (replace all %% with single %), after closing Gimp when it's done with the 1st PNG, does it print the command for the 2nd PNG?
    – Karan
    Jan 16, 2013 at 18:33

1 Answer 1


The solution had two parts:

Part 1: The syntax of the batch command was wrong, especially the quotes need to be set correctly:

for %%x in (*.png) do "C:\Program files\GIMP\bin\gimp-2.8" -i -b "(script-fu-functionname \"%%x\"

Parts 2: Gimp always waiting for me to "press any key" was due to the wrong binary used: Instead of gimp-2.8, gimp-console-2.8 must be used.

Thanks, Karan, for hinting at the solutions.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .