I don't do a lot of image editing, but when I do, I tend to use the GIMP. It is sometimes useful to edit an image to make one colour transparent. I'm a simple chap, and one thing I often want to do, is to make non-transparent images into transparent images, whether from a digital camera or editing an existing digital image.

The stuff I found indexed by Google related to older version of the GIMP, and no longer applied. The instructions here have been tested with versions 2.2.11 and 2.2.13 of The Gimp.

  1. Layer -> Transparency -> Add Alpha Channel.
  2. Select -> By Colour. (although you could use other selects if you want a different effect)
  3. Click on the colour you want to become transparent. The selection is highlighted with some dashed lines.
  4. Edit -> Clear
  5. Save the file as GIF or PNG.

There are two ways to achieve Select -> By Colour and the like; you can right-click on the image, and choose Select from the menu, then By Colour from the menu which opens up from there. Alternatively, you can choose Select from the menu bar at the top of the image, and then choose By Colour from that menu. The same goes for all the underlined text above.

What did you say? An example? Oh, okay then....

ball.jpg - the original image This is a ball. It's not a particularly special ball, it's just a ball. See the white background, and the boxy appearance? We can get rid of that by making the background transparent. The shadow effect is quite nice, though, so we'll try to keep that effect.

Step 1: Add an Alpha Channel.

Step 2: Select. The steps above say "Select By Colour". However, I started by using the "Select Contiguous regions" tool, just to show that it can be done that way also.

Step 3: The "Contiguous Regions" tool didn't do too well; far too much of the shadow was ignored. We need a much bigger transparent area than that. By using the "By Colour" tool, and playing with the "Threshold" control, we can get a decent result in a few seconds.

Then do an Edit -> Clear as described above.

The finished article (left), with the original (right) for comparison.

finished article. original article.
Gimp Transparency
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon

Get the Book:

Buy my 600-page Shell Scripting Book...

Or from other Amazon in other countries: USA, Germany, France, Spain, Italy, Canada, Japan, India, Brazil
Or from other retailers

Buy this Tutorial in Paperback or for Kindle:

USA, UK, Germany, France, Spain, Italy
Or Kindle in these countries: Canada, Australia, Japan, India, Brazil, Mexico

Buy this Tutorial as a DRM-Free PDF

(Free Sample)

$9.99 US Dollars

£4.99 UK Pounds

€6.99 Euros

You can join our Shell Scripting community on Facebook: