我想要做的是从一个python程序(也许是subprocess.Popen)打开gimp,同时,gimp将从一个python脚本开始,该脚本将打开一个图像并添加一个层......好吧,如何我能做到吗(我希望 GIMP 有更好的文档……)?
更新:
我这样做了:subprocess.Popen(["gimp", "--batch-interpreter" , "python-fu-eval" , "-b" ,"\'import sys; sys.path.append(\"/home/antoni4040\"); import gimpp; from gimpfu import *; gimpp.main()\'"])
,但是,即使控制台说“批处理命令执行成功”,也没有任何反应......
更新2:
from gimpfu import *
def gimpp():
g = gimp.pdb
images = gimp.image_list()
my_image = images[0]
layers = my_image.layers
new_image = g.gimp_file_load_layer("/home/antoni4040/Έγγραφα/Layout.png")
my_image.add_layer(new_image)
new_layer = g.gimp_layers_new(my_image, 1024, 1024, RGBA_IMAGE, "PaintHere", 0, NORMAL_MODE)
my_image.add_layer(new_layer)
register('GimpSync', "Sync Gimp with Blender", "", "", "", "", "<Image>/SyncWithBlender", '*', [], [], gimpp)
main()