実際のところ
from gimpfu import *
def create_image_with_text(filename, text):
image = gimp.Image(320, 320, RGB)
layer = gimp.Layer(image, "Background", 320, 320, RGB_IMAGE, 100, NORMAL_MODE)
image.add_layer(layer, 0)
pdb.gimp_context_set_gradient("Full saturation spectrum CCW")
pdb.gimp_drawable_edit_gradient_fill(layer, 0, 0, 1, 1, 0, 0)
text_layer = pdb.gimp_text_fontname(image, None, 0, 0, text, 10, True, 32, PIXELS, "Sans")
image.add_layer(text_layer, 0)
text_layer.set_offsets((320 - text_layer.width) // 2, (320 - text_layer.height) // 2)
pdb.gimp_file_save(image, text_layer, filename, filename)
gimp.delete(image)
create_image_with_text("Hello_World.png", "Hello, World")
create_image_with_text("Konichiwa_Sekai.png", "こんにちは世界")
create_image_with_text("Script_fu_wa_yoi_bunmei.png", "Script-fuは良い文明")