2

Python のコードをバッチ モードで実行して、既存の Gimp ファイルを編集しようとしています。次のエラーを取得する

バッチ コマンドで実行エラーが発生しました: エラー: ( : 1) eval: バインドされていない変数: コマンドライン実行

私が使用しているコードは次のとおりです。


#!/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()

助けてください。

4

1 に答える 1