GIMP enables you to make plugin in in Python, what I would like to do is to call GIMP function like I would do inside one of this plugin but this return the following error since GIMP doesn't find any running GIMP Core to use.
LibGimpBase-ERROR **: gimp_wire_write_msg: the wire protocol has not been initialized aborting...
I would like to know if it's possible ? And if yes, how ?
Thanks
GIMP-Python is different from the Script-Fu extensions. In Script-Fu, a plug-in is used to execute scripts. In GIMP-Python, the Python script takes center stage and does the work. You can instantiate the GIMP-Python scripts from inside GIMP itself, or you can use GIMP's batch mode to start it from the command line.
Running the Automation Tools on a WorkflowThe tools will open up, work on, save, and close the images one by one. In an earlier tutorial “Automated Jpg to Xcf” we outlined how to import a directory containing jpeg images into a directory with gimp xcf images.
The Python-Fu console is a dialog window running a “Python shell” (a Python interpreter in interactive mode). This console is set up to make use of the internal GIMP library routines of libgimp. You can use the Python-Fu console to interactively test Python commands.
GIMP's Python extensions need to be run from inside a GIMP instance. If you want to use GIMPś API from Python you have to run a GIMP without a graphical UI (passing the -i
parameter from the command line) and running a custom call to the api - with the -b
command line parameter - so, you can run your python_fu_do_it program, from the command line calling:
gimp -i -b \(python-fu-do-it \)
Note that this is the only way to get gimp-python extensions running: you have to run it from inside a GIMP process.
In real life, a useful thing to do might be to make your gimp-plugin expose some functions that perform actions on images that you want, and export those through an xmlrpc or jsonrpc server - which is easily done in Python. You then start this "image server" using the method above, and create stand-alone python script which call your gimp-using functions through xmlrpc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With