首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gimp -当前图像没有作为参数传递给我的插件函数

Gimp -当前图像没有作为参数传递给我的插件函数
EN

Stack Overflow用户
提问于 2015-01-03 11:43:54
回答 2查看 231关注 0票数 0

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

并对其执行register

代码语言:javascript
复制
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得到这个错误:

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

EN

回答 2

Stack Overflow用户

发布于 2015-01-13 09:30:31

下面的代码现在可以在我的机器上运行了。关于您需要传递的参数,我最初的回答是正确的。

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

代码语言:javascript
复制
#!/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
EN

Stack Overflow用户

发布于 2015-01-08 09:05:30

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

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

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

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27751506

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档