Writing GIMP Scripts and Plug-Ins


Notes on GIMP Scripting is a cheat-sheet with information on how to get started. It summarizes the information in my GIMP scripting talks, with extra information that doesn't fit in a short talk.


Slides from my 40-50-minute SCALE9x and OSCON scripting talk start here: GIMP Scripts and Plug-ins.
Slides from my 30-minute LGM scripting talk start here: GIMP Scripts and Plug-ins.

Navigate the slides with space/backspace, right/left arrow or page up/down.
You can also view the slides from the 2.5-hour LGM workshop.

Code samples

I've collected a few templates and example programs collected that might be helpful in getting started writing GIMP scripts in Script-Fu or Python.

Get them all as a tarball: gimp-script-templates.tar.gz or zip file: gimp-script-templates.zip

You can also browse these and other plug-ins on my GIMP Plug-ins repository on Github.

Or explore the scripts individually here:

Python sample scripts

  • helloworld.py: "Hello world" in Python -- create a new image with text in it
  • pytemplate.py: a small template for a Python plug-in that runs on an image
  • pyui.py: show how to use all the available UI parameters (but which does nothing with them)
  • whirlpinch.py: whirlpinch (from the GIMP source), an example of one way to tiles and write to pixel regions from Python.
  • arclayer.py: A fast way to read and write pixel regions from Python.
  • arrowdesigner.py: Interactive Python plug-in for making arrows, demonstrating a simple custom dialog.
  • life.py: Conway's Game of Life, sort of. A silly GIMP demo that isn't particularly useful, but it does demonstrate how to control a Python script from a separate dialog.
  • ratio_info.py: Demonstrate how to use a timer to query selection size and display output in a separate dialog. Author: Joao Bueno.

Script-fu samples

  • helloworld.scm: "Hello world" in Script-fu: create a new image with a text layer.
  • sftemplate.scm: a small template for a Script-fu.
  • ts-helloworld.scm: a "Hello world" Script-Fu that was the first test of Tiny-fu.
  • test-sphere.scm: a sphere generator with the world's most complicated user interface -- and good documentation in the comments explaining all the UI options.
  • sphere.scm: the basic and simple Sphere script that used to be included in GIMP

Outside Links, Documentation



C plug-ins

Steps for Installing Python-fu on Windows

  1. Install Python (python.org)
  2. Install pygobject, pycairo, and pygtk (pygtk.org)
  3. Install GIMP (gimp.org)

I also have some old slides from a GIMP scripting tutorial from Linux.conf.au, Melbourne, 2008.