我有这个函数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得到这个错误:

似乎Gimp没有将当前图像传递给我的插件,所以传递了6个参数,而不是7个。我该如何解决这个问题?
发布于 2015-01-13 09:30:31
下面的代码现在可以在我的机器上运行了。关于您需要传递的参数,我最初的回答是正确的。
还请注意,我必须将菜单更改为标签。
#!/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发布于 2015-01-08 09:05:30
这可能看起来很奇怪,但也许可以试一试
def enumerategrid(image, layer ,width, height, tcolor, theight, font, startfrom)
这里的例子可能会有所帮助。
http://registry.gimp.org/node/28124
https://stackoverflow.com/questions/27751506
复制相似问题