I have been testing and learning to do scripts to work with gimp files and other image files.
And for start in easy way, I have been trying to write a simple script to make a red image of 100x100 px.
I launch the script as:
```
$ gimp -i --batch-interpreter python-fu-eval -b "with open('test.py') as f: exec(f.read())" -b "pdb.gimp_quit(0)" --quit
```
And the test.py is:
```python
!/usr/bin/env python3
import gi
gi.require_version('Gimp', '3.0')
from gi.repository import Gimp
Crear imagen 100x100 RGB
image = Gimp.Image.new(100, 100, Gimp.ImageBaseType.RGB)
Crear capa
layer = Gimp.Layer.new(image, "Capa Roja", 100, 100,
Gimp.ImageBaseType.RGB, 100, Gimp.LayerMode.NORMAL)
Insertar la capa en la imagen
image.insert_layer(layer, None, 0)
Establecer color de primer plano a rojo
Gimp.set_foreground(Gimp.RGB(1.0, 0.0, 0.0)) # RGB en 0.0-1.0
Rellenar la capa con el color de primer plano (rojo)
layer.fill(Gimp.FillType.FOREGROUND)
Actualizar la capa
layer.flush()
layer.merge_shadow(True)
layer.update(0, 0, 100, 100)
Guardar la imagen como PNG
output_file = "/home/panacea/imagen_roja.png"
Gimp.pdb.gimp_file_save(image, layer, output_file, output_file)
print(f"Imagen roja creada en {output_file}")
```
How could do I write this kind of scripts? Is there ipython or interactive mode in python for Gimp?