Posts Tagged ‘barcamplondon6’

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 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.



Creating multi-layered screenshots (a BarCamp London hack)

Sunday, March 29th, 2009

I’m on a slow (gah, engineering works!) train back from an awesome BarCampLondon. I’ve got a ton of notes from so many fascinating talks and sessions, but not quite sure how to share them… they would make for the world’s longest blog post!

But as I have a little time to kill, I thought I’d quickly share a little hack that I pulled together overnight. An old idea, but a fun one – and it’s amazing what beer and interesting people will do for your creativity. 🙂

The hack is a little Windows utility to capture more useful screenshots.

By way of background, when you press the “Print Screen” button, it copies an image of your desktop to the clipboard. Very useful. But it has limitations.

What if a window you want to see in the screenshot image is obscured by another window? Or minimised entirely? That information is lost.

Not with my hack! 🙂

My tool captures “interactive” multi-layered screenshots – a picture of each window is captured separately on it’s own layer. This creates a screenshot that (even after you’ve taken the screenshot) will let you move windows around, hide/restore windows, and change the z-order of windows.

It creates a sort of simulation-like snapshot of what your desktop was like at the time.