For a project I was recently working on I needed to remove the white background from several hundred images in PNG format and replace it with transparency. I know you can automate Photoshop but that’s like getting into a Sherman tank to go shopping at your local supermarket. Another constraint (other than my reluctance to wrangle Photoshop) was the need to be able to do this in the future as part of a process to be built into a virtual machine running Linux.

Then I remembered GIMP, the GNU Image Manipulation Program. GIMP, a free, open source image editor, that’s available for Windows, OS X, Ubuntu, Debian, openSUSE, Fedora, Mandriva, BSD, and Solaris and one of its neat features is an automation plugin called BIMP (though you can also automate GIMP with Python which, like GIMP’s batch mode, is not for beginners).

To remove the white backgrounds I first had to reformat the PNG files to RGB from their default indexed colour mode. This is something you’ll usually want to do otherwise the image will be constrained to the palette used in the file. The command I needed is in the “Other GIMP procedure” picker list as gimp-image-convert-rgb.

Mark Gibbs

Plugin gimp-image-convert-rgb

Once you've select that and clicked OK you return to the “Other GIMP procedure” picker and select plug-in-colortoalpha. Then click on the color button and select your target color (in my case it was white). You've now built a sequence of simple manipulations that can be run on one or more files.

Mark Gibbs

GIMP color picker for plug-in-colortoalpha

Now all you need to do is add images with the "Add image" file button, select your output folder, and click "Apply". Voila!

So, if you don’t want to shell out the big bucks for the likes of Photoshop you can’t beat GIMP’s price and there are a huge number of training guides on the GIMP site and elsewhere online.

While GIMP is by no means a simple program (it’s really just as complex as Photoshop and some might argue more so) there are many functions and operations that are easier. If you’ve got any good GIMP tips, let me know …

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.