12-27-2021, 04:12 PM
(12-27-2021, 01:42 PM)programmer_ceds Wrote:(12-27-2021, 09:59 AM)z-uo Wrote: I want to learn to create Python3 plugins for GIMP. And when I search I do not find much examples on the web so I ask here. The main thing that I want to do (and document on this thread is):
- goat-exercise tutorial and learn
- port a plugin from python2 to python3 (maybe I will port gimp-balloon-plugin)
- create AI based plugins using torch AI like GIMP-ML do with Opencv. For example some interesting features are:
I start from the point 1:
- OCR: to recognize and maybe translate some text inside images
- Super resolution: increase the resolution with a deep algorithm
- Inpainting: redraw some removed areas automatically
I miss some configurations? What should I see in there?
- GIMP 2.99.8 installed with flatpack on Opnesuse Tumbleweed
- I put goat-exercise into ~/.config/GIMP/2.99/plug-ins/python
- Restart Gimp
- I do not see nothing new into Filters > Development > Goat exercises
Firstly if your Python plug-in is called myplugin.py (for example) then you have to put this into a folder called myplugin and put the folder into the user plug-ins folder. On my system with the flatpak version this is:
/home/richard/.var/app/org.gimp.GIMP/config/GIMP/2.99/plug-ins
On Linux based systems you also need to make Python scripts executable otherwise they will not appear in the menus.
Also check for any obvious errors by running the script in a terminal window for example:
./myplugin
this should report any obvious problems of syntax or indentation.
Then when testing your script run GIMP from a terminal window - you may see error messages that relate to your script.
For debugging you can use print statements in your script - run GIMP from a terminal window and the output will be seen in the terminal window.
For a few examples of Python 3 scripts the easiest thing may be to download the GIMP V2.99 sources and then look in:
.../GIMP 2_99/gimp-master/plug-ins/python
(obviously the first part of the path will depend on where you have unzipped the sources)
Thank you! I added "~/.config/GIMP/2.99/plug-ins/" to Edit > Preferences > Folders > Plug-Ins, after I put my script called es1.py into the folder es1 and not pythont. I do chmod +x es1.py and now it works! Thank you!