7

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!

caw
  • 218

1 Answers1

8

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.

caw
  • 218