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.

NOTE:
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

Want to take the tutorial with you?

My Shell Scripting Book:
    Shell Scripting, Expert Recipes for Linux, Bash and more
is available online and from all good booksellers.

Buy my 564-page Shell Scripting Book...

From Amazon USA:

From Amazon UK:

For Kindle:

Or From other retailers

You can also find the book, and join a shell scripting community, on Facebook:


Option Two: Buy the 70-page PDF (£4.99/$9.99/€6.99)
(Free Sample)

And you can always Download my Free Shell Scripting Cheatsheet PDF