Download scripts/gimp_example.py from fariasultanacodes/x11-desktop: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/fariasultanacodes/x11-desktop/resolve/main/scripts/gimp_example.py
- Command line
-
hf download hf://spaces/fariasultanacodes/x11-desktop/scripts/gimp_example.py
-
curl -L -o gimp_example.py https://huggingface.co/spaces/fariasultanacodes/x11-desktop/resolve/main/scripts/gimp_example.py
1.15 kB
| #!/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() | |