我正在尝试以批处理模式执行一段 Python 代码来编辑现有的 Gimp 文件。收到以下错误
批处理命令遇到执行错误:错误:(:1)评估:未绑定变量:命令行执行
这是我正在使用的代码:
#!/usr/bin/env python
from gimpfu import *
# the script
def my_tf_cmd_function(fle, fontname, fontsize) :
image = pdb.gimp_file_load(fle,fle)
drawable = pdb.gimp_image_get_active_layer(image)
image.undo_group_start()
foreground = gimp.get_foreground()
gimp.set_foreground(240,240,240)
textlayer1 = gimp.Layer(image, "Troo", drawable.width, drawable.height, RGBA_IMAGE, 100, NORMAL_MODE)
image.add_layer(textlayer1, 0)
pdb.gimp_drawable_fill(textlayer1, 3) # transparent fill
gimp.set_background(255, 255, 255)
gimp.set_foreground(240,240,240)
floattext = pdb.gimp_text_fontname(image, textlayer1, 200, 100, "T", 1, 1, fontsize, 1, fontname)
pdb.gimp_floating_sel_anchor(floattext)
gimp.set_foreground(foreground)
image.undo_group_end()
pdb.gimp_file_save(image, drawable, "/home/Downloads/img.xcf", "/home/Downloads/img.xcf")
return
# This is the plugin registration function
register(
"command_line_execution",
"My Command Line Attempt Python-Fu",
"This script does nothing and is extremely good at it",
"RC",
"RC",
"May 2013",
"<Image>/MyScripts/My Command Python-Fu",
"*",
[
(PF_STRING, "fle", "GlobPattern", "*.*"),
(PF_FONT, "fontname", "Foo font", "Arial"),
(PF_INT, "fontsize", "Foo font size", 18)
],
[],
my_tf_cmd_function,
)
main()
请帮忙。