Automate image editing with GIMP

Automate image editing with GIMP

I needed to remove the white background from several hundred images in PNG format and replace it with transparency

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

Installing GIMP is fast and painless so I won't belabor it here. Once installed you need to download BIMP, the Batch Image Manipulation Plugin, and install it (see Wikibooks GIMP/Installing Plugins for the details). Again, easy-peasey.

When GIMP is restarted you'll find BIMP hidden in the file menu.

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.

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.

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

Follow Us

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags open sourceubuntueditingsoftwarefedoramandrivasuseGraphics &amp


EDGE 2023

EDGE is the leading technology conference for business leaders in Australia and New Zealand, built on the foundations of collaboration, education and advancement.


ARN has celebrated gender diversity and recognised female excellence across the Australian tech channel since first launching WIICTA in 2012, acknowledging the achievements of a talented group of female front runners who have become influential figures across the local industry.

ARN Innovation Awards 2023

Innovation Awards is the market-leading awards program for celebrating ecosystem innovation and excellence across the technology sector in Australia.

Show Comments