Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learn to create Python3 plugins
#2
(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):
  1. goat-exercise tutorial and learn
  2. port a plugin from python2 to python3 (maybe I will port gimp-balloon-plugin)
  3. create AI based plugins using torch AI like GIMP-ML do with Opencv. For example some interesting features are:
  • 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 start from the point 1:
  • 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
I miss some configurations? What should I see in there?

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)
Reply


Messages In This Thread
Learn to create Python3 plugins - by z-uo - 12-27-2021, 09:59 AM
RE: Learn to create Python3 plugins - by programmer_ceds - 12-27-2021, 01:42 PM
RE: Learn to create Python3 plugins - by z-uo - 12-27-2021, 04:12 PM
RE: Learn to create Python3 plugins - by z-uo - 12-28-2021, 11:14 AM
RE: Learn to create Python3 plugins - by z-uo - 12-28-2021, 07:27 PM
RE: Learn to create Python3 plugins - by z-uo - 12-29-2021, 05:07 PM
RE: Learn to create Python3 plugins - by z-uo - 12-30-2021, 10:16 AM
RE: Learn to create Python3 plugins - by z-uo - 12-30-2021, 04:56 PM
RE: Learn to create Python3 plugins - by z-uo - 12-30-2021, 05:54 PM
RE: Learn to create Python3 plugins - by z-uo - 12-31-2021, 08:40 AM
RE: Learn to create Python3 plugins - by z-uo - 01-02-2022, 10:37 AM

Forum Jump: