Error: ( : 1) Invalid number of arguments for python-fu command line execution
Error: ( : 1) Invalid number of arguments for python-fu command line execution
我已将以下 python 脚本添加到 /usr/lib/gimp/2.0/plug-ins 文件夹
#!/usr/bin/python
from gimpfu import *
def scale(imageName):
pass
register(
"my",
"",
"",
"",
"",
"2017",
"<Image>/Image/Hi..",
"RGB*, GRAY*",
[(PF_STRING, 'file_name', 'file_name', 'logo.png')],
[],
scale)
main()
运行 通过
gimp --no-interface -b '(python-fu-my RUN-NONINTERACTIVE "logo.png")' -b '(gimp-quit 0)'
returns
batch command experienced an execution error: Error: ( : 1) Invalid
number of arguments for python-fu-my (expected 4 but
received 2)
在 Gimp 的程序浏览器中确实有 4 个参数,但是如果程序是通过命令行 运行 它不应该期望它们,应该吗?
我关注了docs。
怎么了?
您不应该将函数注册为插件,您应该直接调用它(scale("logo.png")
)。但是您的代码必须显式加载图像文件以获得 gimp.Image 对象。
我已将以下 python 脚本添加到 /usr/lib/gimp/2.0/plug-ins 文件夹
#!/usr/bin/python
from gimpfu import *
def scale(imageName):
pass
register(
"my",
"",
"",
"",
"",
"2017",
"<Image>/Image/Hi..",
"RGB*, GRAY*",
[(PF_STRING, 'file_name', 'file_name', 'logo.png')],
[],
scale)
main()
运行 通过
gimp --no-interface -b '(python-fu-my RUN-NONINTERACTIVE "logo.png")' -b '(gimp-quit 0)'
returns
batch command experienced an execution error: Error: ( : 1) Invalid number of arguments for python-fu-my (expected 4 but received 2)
在 Gimp 的程序浏览器中确实有 4 个参数,但是如果程序是通过命令行 运行 它不应该期望它们,应该吗?
我关注了docs。 怎么了?
您不应该将函数注册为插件,您应该直接调用它(scale("logo.png")
)。但是您的代码必须显式加载图像文件以获得 gimp.Image 对象。