You are here

Getting python scripts to be picked up in the Python Procedure Browser

Hi all. I've been using Gimp 2.6 for a few months now and I've recently got into scripting. I took a very brief look at Scheme (script-fu), but python is much more to my liking, so I installed all the necessary python dependencies and began writing in python. My problem is, I cant seem to get my functions to be recognised by the Procedure Browser.

Here is my code:


from gimpfu import*

def pluginmain(image,drawable):
print "Hello World!"

register (
"python-fu-kiwipycon" ,
N_( "This is an example GIMP plug -in" ) ,
"""A longer description of the plugin.""",
"Roman Joost" ,
"Roman Joost" ,
"2009" ,
N_( "_Kiwi Pycon Plugin..." ) ,
"*" ,
(PF IMAGE , "image" , "Input image" , None ) ,
(PF DRAWABLE, "drawable" , "Input drawable" , None ) ,
] ,
[ ] ,


menu="/Filters/Web" ,



I've put the above code into '' and placed it in:

C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins

Also note that I'm using Windows 7 32 bit, if that changes anything.

Any help would be much appreciated.

Thanks heaps.

I don't think you need to declare the image and drawable parameters in the call to register(). Pygimp (the module gimpfu more precisely?) takes care of them automatically. You do need to declare image and drawable as formal parameters to your plugin main, as you have done.

You might need to preface the menupath with (Image)/Filters/Web where you should read ( and ) as the less than, greater than characters.

You would be better off starting with a plugin that works and hacking it.

If you still have problems, please include the exact error messages, which you should get from Python.

Hi bootchk,

Thanks for the reply.

I tried copying "" and altering its contents so it just prints "hello world" (also changing the first argument of the register function to "python-fu-test"). Gimp still won't register the script though when I start it. I was curious, do I actually need to TELL Gimp to import new scripts somehow, or should it find any valid plugins in the plug-in folder and import them itself on start up?

Is there a way for me to manually tell Gimp to import a particular script? I feel like I'm not doing something that I should be lol.

I've purchased Gimp- from novice to professional (Akanna Peck) a few months ago and have slowly been working through that whenever I have the time, but I was wondering if there was another book on GIMP scripting particularly? The book I have really only has a few pages on scripting (with Python, at least).

Would GIMP scripting in C be easier? I already know C/C++, but I wanted to use Python since it seems to be a common choice for scripting inside other apps (eg Blender).

Thanks a lot for any replies every1.

Look here

or pickup a python plugin and look at its code.

GIMP finds the plugins on startup. If your plugin doesn't work, try downloading one from here and installing it alongside yours. If it doesn't work, you might have an installation problem with either GIMP, Python, or your personal plugins.

A common installation error on Linux is to not make the plugin file executable. I don't think that applies to Windows, but maybe you have to tell Windows that .py files should be opened by the Python interpreter?

I don't know of a way to tell GIMP to reload Python scripts. You can tell it to reload the Scheme scripts by choosing Filters/Gimpfu/Reload scripts.

Note however that you can make changes to the Python files and GIMP will find the changes the next time you run the plugin, without restarting GIMP, except if you change the register() function (which GIMP calls only once, at GIMP startup.)

I prefer Python. I know C also, and it has its place. But I used to know assembly language too, and I rarely use it now. Unless you need the performance, for example iterating over pixels one at a time, use Python. VERY MUCH EASIER, if you know Python (and it is worth knowing.)

I don't know of any books on GIMP and Python.

bbcode does not work on this forum, you can use html, click enable rich text and then html in the toolbar. It is important you show us your code in a way that preserves the spacing before lines as python has significant whitespace.

Subscribe to Comments for "Getting python scripts to be picked up in the Python Procedure Browser"