【发布时间】:2015-09-15 21:27:00
【问题描述】:
我正在尝试为 GNU Image Manipulation Plug-In 编写我自己的 Python 插件。我在这个 URL 上关注本教程:http://gimpbook.com/scripting/slides/index.html。我更改了一些变量名称并将脚本命名为不同的名称,但基本上它是相同的脚本。
从交互式 GIMP Python shell 调用该脚本时该脚本有效。我用鼠标访问:“Filters -> Python-Fu -> Console”。 hello_world() 函数在这里起作用。
但是,当我将插件放在.gimp2.8/plugins/ 文件夹或/usr/lib/gimp/2.0/plug-ins 中时,我在转到Help -> Plug-In Browser 后无法看到Plug-In Browser 中的插件。有谁知道我错过了什么?
问候,
我的 Python GIMP 插件源代码如下...
#! /usr/bin/env python
from gimpfu import *
def hello_world(initstr, font, size, color):
img = gimp.Image(1, 1, RGB)
gimp.set_foreground(color)
layer = pdb.gimp_text_fontname(img, None, 0, 0, initstr, 10, True, size, PIXELS, font)
img.resize(layer.width, layer.height, 0, 0)
gimp.Display(img)
register(
"pythonic_easier_gimp",
"Hello Gimp Image", "Hello gimp image",
"My Name", "My Name", "2015",
"Easier gimp...",
"",
[
(PF_STRING, "string", "String", 'Hello, Gimp!'),
(PF_FONT, "font", "Font face", "Sans")
(PF_SPINNER, "size", "Font size", 50, (1, 3000, 1)),
(PF_COLOR, "color", "Text color", (1.0, 0.0, 0.0))
],
[],
easier_gimp, menu="<Image>/File/Create")
main()
【问题讨论】: