Gimp Python Documentation

James Henstridge

          
        

Published v0.4, 5 July 1999

This document outlines the interfaces to Gimp-Python, which is a set of Python modules that act as a wrapper to libgimp allowing the writing of plug-ins for Gimp. In this way, Gimp-Python is similar to Script-Fu, except that you can use the full set of Python extension modules from the plug-in.


Table of Contents
Introduction
The Structure Of A Plugin
The Procedural Database
Gimp Module Procedures
Gimp Objects
Support Modules
End Note

Introduction

What is it?

Gimp-Python is a scripting extension for Gimp, similar to Script-Fu. The main difference is in what is called first. In Script-Fu, the script-fu plugin executes the script, while in Gimp-Python the script is in control.

In fact, you will find that the Gimp-Python scripts start with the line #!/usr/bin/python. The gimp extension is loaded with the familiar import command.

Another point of difference between Gimp-Python and Script-Fu is that Gimp-Python stores images, layers, channels and other types as objects rather than just storing their ID. This allows better type checking that is missing from Script-Fu, and allows those types to act as objects, complete with attributes and methods.

Also, Gimp-Python is not limited to just calling procedures from the PDB. It also implements the rest of libgimp, including tiles and pixel regions, and access to other lower level functions.

Installation

Gimp-python consists of a Python module written in C and some native python support modules. You can build pygimp with the commands:

./configure
make
make install

This will build and install gimpmodule and its supporting modules, and install the sample plugins in gimp's plugin directory.