|
|
|
|
|
from gimpfu import * |
|
|
|
|
|
def create_image(width, height, text): |
|
|
|
|
|
img = pdb.gimp_image_new(width, height, RGB) |
|
|
|
|
|
|
|
|
layer = pdb.gimp_layer_new(img, width, height, RGB_IMAGE, "Background", 100, NORMAL_MODE) |
|
|
pdb.gimp_image_insert_layer(img, layer, None, 0) |
|
|
|
|
|
|
|
|
pdb.gimp_context_set_foreground((255, 255, 255)) |
|
|
pdb.gimp_drawable_fill(layer, FOREGROUND_FILL) |
|
|
|
|
|
|
|
|
pdb.gimp_context_set_foreground((0, 0, 0)) |
|
|
text_layer = pdb.gimp_text_fontname(img, None, 10, 10, text, 0, True, 24, PIXELS, "Sans") |
|
|
|
|
|
|
|
|
display = pdb.gimp_display_new(img) |
|
|
|
|
|
register( |
|
|
"python_fu_create_image", |
|
|
"Create a new image with text", |
|
|
"Creates a new image with the specified dimensions and text", |
|
|
"AI Agent", |
|
|
"AI Agent", |
|
|
"2024", |
|
|
"<Toolbox>/Xtns/Languages/Python-Fu/Test/_Create Image...", |
|
|
"", |
|
|
[ |
|
|
(PF_INT, "width", "Width", 1920), |
|
|
(PF_INT, "height", "Height", 1080), |
|
|
(PF_STRING, "text", "Text", "Hello from AI Agent!"), |
|
|
], |
|
|
[], |
|
|
create_image) |
|
|
|
|
|
main() |
|
|
|