File size: 1,148 Bytes
4408617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
from gimpfu import *

def create_image(width, height, text):
    # Create a new image
    img = pdb.gimp_image_new(width, height, RGB)
    
    # Create a new layer
    layer = pdb.gimp_layer_new(img, width, height, RGB_IMAGE, "Background", 100, NORMAL_MODE)
    pdb.gimp_image_insert_layer(img, layer, None, 0)
    
    # Fill with white
    pdb.gimp_context_set_foreground((255, 255, 255))
    pdb.gimp_drawable_fill(layer, FOREGROUND_FILL)
    
    # Add text
    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 the image
    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()