Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

PyGIMP: Support for writing GIMP plugins in Python UNIX
Being able to use Python to write GIMP plugins is nice. Here is how I built pygimp 1.2 for GIMP 1.2.5 from Fink 0.6.2 installed to /sw on Mac OS X 10.3.3. First are what I did for GTK+ (1.2) followed by the differences for GTK+2 (2.0). I make no claims that this is the best way or that this will be relevant when everyone moves to GIMP 2.0 and beyond, but I hope maybe it will help someone.

Read the rest of the hint for the steps...

[robg adds: I haven't tested or reviewed this one -- if you try it and it works (or doesn't), please post in the comments...]

The pygimp software is available here
  1. Fix a "Can't determine host type" problem with ./configure and configure.
    cd pygimp-1.2/
    cp /usr/share/libtool/config.guess .
    cp /usr/share/libtool/config.sub .
    ./configure --prefix=/sw
    
  2. Optionally, edit python files for gtk-2 as described below.
  3. Make and install:
    make
    sudo make install
    
  4. Fixed problem where gimpmodule.so is not built. The symptom of this problem is that "import gimpfu" fails because "import gimp" fails. I built gimpmodule.so using Python distutils.

    1. Create a setup.py file as shown here for gtk+ (ver. 1.2) or use the one below for gtk+2 (ver. 2.0):
      from distutils.core import setup, Extension
      module1 = Extension('gimpmodule',
                          sources = ['gimpmodule.c'],
                          include_dirs = ['/sw/include/', '/sw/include/glib-1.2',
                                          '/sw/lib/glib/include'],
                          library_dirs = ['/sw/lib'],
                          libraries=['gimp', 'glib', 'intl'])
      
      
      setup (name = 'gimpmodule',
             version = '1.2',
             description = 'Library for PyGimp',
             ext_modules = [module1])
      
    2. Build gimpmodule.so:
        python setup.py build
      
    3. Install gimpmodule.so (change python2.2 to subdirectory that matches your version of python if necessary):
        sudo cp build/lib.darwin-7.3.0-PowerMacintosh-2.2/gimpmodule.so /sw/lib/python2.2/site-packages/
      

If anyone wants to try fixing the makefile, here are the commands that "python setup.py build" used for GTK 1.2:

  gcc -DNDEBUG -O3 -Wall -Wstrict-prototypes -I/sw/include/ 
     -I/sw/include/glib-1.2 -I/sw/lib/glib/include 
     -I/sw/include/python2.2 -c gimpmodule.c 
     -o build/temp.darwin-7.3.0-PowerMacintosh-2.2/gimpmodule.o

  gcc -L/sw/lib -bundle -flat_namespace -undefined suppress 
     build/temp.darwin-7.3.0-PowerMacintosh-2.2/gimpmodule.o -L/sw/lib 
     -o build/lib.darwin-7.3.0-PowerMacintosh-2.2/gimpmodule.so

Optionally, for using pygimp with pygtk for gtk+2 instead of gtk+ (which makes things compatible with RedHat Linux 9):

  1. Edit gimpfu.py, gimpui.py, plug-ins/gimpcons.py and plug-ins/pdbbrowse.py so that "gtk.Gtk" is replaced with "gtk."
  2. Disable the logo in gimpfu.py by commenting out (I was too lazy to fix it). Before:
    	pix = _get_logo(vbox.get_colormap())
    	vbox.pack_start(pix, expand=gtk.FALSE)
    	pix.show()
    

    After:

    	# pix = _get_logo(vbox.get_colormap())
    	# vbox.pack_start(pix, expand=gtk.FALSE)
    	# pix.show()
      
  3. Edit plug-ins/gtkcons.py to replace "Gtk" with ""
  4. sudo make install
  5. Use the following setup.py in the above procedure:
    
    from distutils.core import setup, Extension
    module1 = Extension('gimpmodule',
                        sources = ['gimpmodule.c'],
                        include_dirs = ['/sw/include/', '/sw/include/glib-2.0',
                                        '/sw/lib/glib-2.0/include'],
                        library_dirs = ['/sw/lib'],
                        libraries=['gimp', 'glib-2.0', 'intl'])
    
    setup (name = 'gimpmodule',
           version = '1.2',
           description = 'Library for PyGimp',
           ext_modules = [module1])
    
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[12,316 views]  

PyGIMP: Support for writing GIMP plugins in Python | 2 comments | Create New Account
Click here to return to the 'PyGIMP: Support for writing GIMP plugins in Python' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
PyGIMP: Support for writing GIMP plugins in Python
Authored by: wgscott on Apr 08, '04 11:36:43AM

You should make this into a fink package. Most if not all of your changes could be put in one patch file, and the info file would be very straightforward.



[ Reply to This | # ]
PyGIMP 1.2 is out of date
Authored by: es3 on Apr 08, '04 05:47:44PM

The author of PyGIMP kindly informed me that PyGIMP 1.2 is out of date and that GIMP 2.0 includes the current version of PyGIMP. I haven't moved to GIMP 2.0 yet, but that is what I plan. I'll evaluate whether my making any Fink packages as suggested by wgscott makes sense after I have some experience with GIMP 2.0.



[ Reply to This | # ]