根据您的操作系统,您必须查找 GIMP 插件的目录,例如:
GIMP 2\lib\gimp\2.0\plug-ins
并在那里复制你的脚本。当然,您必须添加类似这样的注册内容:
register(
"python-fu-draw", #<- this is plugin name
N_("brief"), #<- description
"Long", #<- description
"name surname", #<- author
"@Copyright 2013", #<- copyright info
"2013/10/29", #<- creation date
N_("_Draw..."), #<- label shown in gimp's menu
"", #<- kind of image requested from your script (INDEX,RGB,...and so on)
[ #<- input parameters array
(PF_FILE, "ifile", N_("Color input file"), 'default.txt'),
],
[], #<- output parameters array (usually empty)
draw, #<- main method to call
menu="<Image>/Filters/", #<- Where add your plugin
domain=("gimp20-python", gimp.locale_directory)
)
main() #<- don't forget this
将脚本复制到具有正确注册内容的正确目录后,您可以运行 GIMP 并运行脚本,在您在注册内容中选择的下拉菜单中选择它。您不必从 python 控制台运行它。所以那些行不通:
python myscript.py
./myscript.py
>>> myscript
要以交互方式调试脚本,请从 gimp 打开一个 python-fu 控制台:
Filters->Python-fu->Console
看看这个网站。主要是幻灯片非常有用。
如果您想以批处理模式运行脚本,请查看此