caw*_*caw 5 gimp batch image-processing
在我的 windows 机器上,我想使用 GIMP 修改filename.png当前目录中的所有 PNG 文件 ( ) 并将输出文件保存到子目录out/filename.png. 需要的处理是:
为此,我尝试使用以下脚本并将其放置在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")
Run Code Online (Sandbox Code Playgroud)
之后,我尝试使用以下批处理文件调用此脚本:
for %%x in (*.png) do "C:\Program files\GIMP\bin\gimp-2.8" -i -b "(script-fu-shadowcorners \"%%x\" \"newfolder\\%%x\")"
Run Code Online (Sandbox Code Playgroud)
这没用。它总是说找不到文件,速度很慢,而且没有输出。
现在CMD命令起作用了,至少问题还没有完全解决。在 CMD 中,我的批处理命令后面会出现一行,用%%x第一个文件名替换通配符 - 但只是第一个。在输出目录中,我也找不到第一个以外的文件。尽管如此,Gimp 的输出是batch command executed successfully.
我究竟做错了什么?你能帮助我吗?非常感谢!
该解决方案有两个部分:
Part 1:批处理命令的语法错误,尤其是引号需要设置正确:
for %%x in (*.png) do "C:\Program files\GIMP\bin\gimp-2.8" -i -b "(script-fu-functionname \"%%x\"
Run Code Online (Sandbox Code Playgroud)
第 2 部分: Gimp 总是等待我“按任意键”是由于使用了错误的二进制文件:必须使用而不是gimp-2.8, gimp-console-2.8。
谢谢,卡兰,暗示解决方案。