01-04-2025, 11:11 AM
You can't do this. Your Python code relies on the whole Gimp executable for most of its functionality. The gi repos are merely interfaces to code in Gimp, Gegl and Babl. In fact the code in the Gimp import only works when its caller (your code) is called from Gimp... You could have more luck with just Gegl/Babl.
You can run Gimp without a UI (-i, --no-interface) and it is likely possible to run flatpak-Gimp in batch mode (even if the start incantation is likely a bit different). But installing Gimp form a .deb would be a lot easier, and .deb Babl/Gegl would be a requirement if you can skirt Gimp. You can get 3.00 RC2 DEB fro here: https://launchpad.net/~mati75/+archive/ubuntu/gimp30
But very often, I see people writing very complicated scripts around Gimp to do rather simple things that are better done with shell scripts around ImageMagick or with Python and image processing libraries (pillow, openCV...).
You can run Gimp without a UI (-i, --no-interface) and it is likely possible to run flatpak-Gimp in batch mode (even if the start incantation is likely a bit different). But installing Gimp form a .deb would be a lot easier, and .deb Babl/Gegl would be a requirement if you can skirt Gimp. You can get 3.00 RC2 DEB fro here: https://launchpad.net/~mati75/+archive/ubuntu/gimp30
But very often, I see people writing very complicated scripts around Gimp to do rather simple things that are better done with shell scripts around ImageMagick or with Python and image processing libraries (pillow, openCV...).