Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp, Python versions, and flatpak
#1
I've been writing a python plugin for gimp, using RC2 installed with flatpak.  It's been a steep learning curve but i have it working.
I now want to take some of that code and put it in a standalone python app, since it doesn't actually need the gimp interface

My idea was to simply use the system python and import the necessary gi repository files - but they are already installed inside the flatpak

Is there a way to use the python version installed with gimp and flatpak from outside the flatpak sandbox?
Or should I copy the gi repository files into the system python directories, and if so where?

Many thanks
Reply
#2
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...).
Reply


Forum Jump: