Gimp - 当前图像不作为参数传递给我的插件功能

时间:2015-01-03 03:43:54

标签: gimp gimpfu

我有这个功能def enumerategrid(image, width, height, tcolor, theight, font, startfrom)

register编辑:

gimpfu.register(
    proc_name="enumerategrid_plugin-pdb",
    blurb="Enumera rejillas en una imagen",
    help="Enumera rejillas en una imagen",
    author="Jorge Araya Navarro <elcorreo@deshackra.com>",
    copyright="Servants of the Secret Fire Game Studios",
    date="2015",
    label="Enumerar rejilla...",
    imagetypes="*",
    params=[
        (gimpfu.PF_INT32, "width", "ancho de la reja", 32),
        (gimpfu.PF_INT32, "height", "altura de la reja", 32),
        (gimpfu.PF_COLOR, "tcolor", "Color del texto", (1.0, 1.0, 1.0)),
        (gimpfu.PF_SPINNER, "theight", "Tamaño del texto", 8, (1, 50, 1)),
        (gimpfu.PF_FONT, "font", "Tipografía", "Monospace"),
        (gimpfu.PF_SPINNER, "startfrom", "Contar desde", 0, (0, 3000, 1))
    ],
    results=[],
    function=enumerategrid,
    menu="<Image>/Desarrollo de juegos/rejillas"
)

但是,当我想运行新安装的插件时,我从Gimp收到此错误:

enter image description here

似乎Gimp没有将当前图像传递给我的插件,因此传递了6个参数而不是7.如何解决此问题?

2 个答案:

答案 0 :(得分:1)

以下内容现在适用于我的机器。我原来的答案是正确的,你需要通过的参数。

请注意,我必须将菜单更改为标签。

#!/usr/bin/env python
#https://stackoverflow.com/questions/27751506/gimp-the-current-image-is-not-passed-as-parameter-to-my-plug-in-function/27831408#27831408

from gimpfu import *
import os



def enumerategrid(image, layer, width, height, tcolor, theight, font, startfrom):

    pass



register(
        proc_name="enumerategrid_plugin-pdb",
        blurb="Enumera rejillas en una imagen",
        help="Enumera rejillas en una imagen",
        author="Jorge Araya Navarro <elcorreo@deshackra.com>",
        copyright="Servants of the Secret Fire Game Studios",
        date="2015",
        label="<Image>/Filters/Test/enumerate",
        imagetypes="*",
        params=[
            (PF_INT32, "width", "ancho de la reja", 32),
            (PF_INT32, "height", "altura de la reja", 32),
            (PF_COLOR, "tcolor", "Color del texto", (1.0, 1.0, 1.0) ),
            (PF_SPINNER, "theight", "Tamao del texto", 8, (1, 50, 1)), 
            (PF_FONT, "font", "Tipografia", "Monospace"),
            (PF_SPINNER, "startfrom", "Contar desde", 0, (0, 3000, 1)),
        ],
        results=[],
        function=enumerategrid)



main()
# to make example work, cannot use accented characters on my machine

答案 1 :(得分:0)

这可能看起来很奇怪,但也许可以试试

def enumerategrid(image, layer ,width, height, tcolor, theight, font, startfrom)

这里的例子可能会有所帮助。

http://registry.gimp.org/node/28124