我无法让任何GIMP Fu脚本工作(在Windows 10 Pro 21H2 19044.1826上使用Gimp 2.10.32 (Revision 1)).
考虑这个最小的脚本。它应该读取文件并以不同的名称再次将其写出来,而不应用任何修改:(来源:https://superuser.com/a/1558320/1130040)
(define
(mytest in_filename out_filename)
(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE in_filename in_filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-file-save RUN-NONINTERACTIVE image drawable out_filename out_filename)
(gimp-image-delete image)
)
)
在测试时,我还添加了一个'script-fu-register'块,让我在GIMP的过程浏览器中检查脚本是否被检测到并无错误地加载。因此,脚本的位置也是正确的,以及在选项下设置的脚本路径。
(script-fu-register "mytest"
""
_"Test"
""
""
"2022/07/16"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
要启动脚本,将'cd'到包含源图像'p.jpeg'的目录(即%userprofile%pictures)并调用:
"C:Program FilesGIMP 2bingimp-2.10.exe" -idf -b '(mytest p.jpeg p1.jpeg)' -b '(gimp-quit 0)' --verbose
我希望'p1.jpeg'是'p.jpeg'的精确副本,写入同一目录。
会发生什么:打开一个协议窗口,其中包含:
(…)
启动扩展:'extension-script-fu'
没有指定批处理解释器,使用默认的'plug-in-script-fu-eval'。
batch command executed successfully
batch command executed successfully
然后保持打开状态。没有错误消息。但是也没有输出文件。
如果我拼错了函数名'mytest'或传递一个不存在的文件名作为第一个参数(something.jpeg),我将不会收到错误消息。
我通过添加--batch-interpreter plug-in-script-fu-eval
来消除消息"没有指定批处理解释器"。
我试着:
- 重新安装Gimp
- 可选择在干净的Windows 11 Pro 21H2 22000.795
- 不同的源/dest目录。图像文件
- 不同的图像格式(.png, .jpeg)和文件
- 命令窗口作为提升的管理员和普通用户
- 一个不同的脚本(https://opensource.com/article/21/1/gimp-scripting)
- 有和没有'script-fu-register'块
- 文件参数,带或不带引号,完整路径
- 使用
-b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE p.jpeg p.jpeg)))(drawable (car (gimp-image-get-active-layer image))))(gimp-file-save RUN-NONINTERACTIVE image drawable p1.jpeg p1.jpeg)(gimp-image-delete image))'
从命令行执行所有命令
最后,我在Windows上使用以下命令行语法使其工作:
"C:Program FilesGIMP 2bingimp-2.10.exe" -idf -b "(mytest "p.jpeg" "p1.jpeg")" -b "(gimp-quit 0)"
- 双引号"-b命令
- 转义双引号">