Posts Tagged ‘script-fu’

ScriptFu – scripting with Gimp

Wednesday, April 1st, 2009

I wrote on Sunday about my first attempt to use Gimp to script some image manipulation stuff I wanted to do – specifically, combining multiple images into a single, multi-layered image.

A few people have asked me for more info about how to do this, so I thought I’d share my script here. Gimp is an open-source image editor, but it also comes with a batch mode where you can run it’s functions from a script. The scripting language for Gimp is called ScriptFu, and is a Lisp-type language. I’ve not done anything in Lisp since learning Scheme at University… so it felt a little odd at first.

This was my first attempt at writing in ScriptFu, so it’s worth pointing that I’m not an expert, and what I’ve written might not be elegant or the “right” way to do it. But I did manage to get something working in a few hours of playing with it.

To start with, a few tips from how I got started:

The doc – The documentation on scripting at docs.gimp.org is fantastic, and got me off to a quick start. It includes enough snippets and samples that I could see the sort of thing I’d need to do.

Gimp’s PDB – If you launch Gimp, go to Help -> Procedure Browser. It starts up a very neat searchable API doc for all of the Gimp functions. Even when I didn’t know the name of functions I needed, typing a quick guess (e.g. “layer”) into here would show me a few sensibly-named options, and show me the full API info for them all.

Photobucket

(more…)