by Rahel Lüthy
Assume you would like to change the background color of the following image to black:
A quick attempt to do so could include some magic wand or lasso tool wizardry (in Gimp, Photoshop, or any other image manipulation program).
Bad solution:
Because the blue circle is semi-transparent and its edge is anti-aliased, the result looks rather crappy (the white edge is also known as the halo-effect). No matter how much you fiddle with the selection tool parameters, what’s wrong is the usage of the selection tool in the first place.
The proper approach is to convert the original background color to a transparent (alpha) color. In gimp 2.x the corresponding utility can be found in the “Colors” context menu and is called “Color to Alpha” (I am confident that you will find the equivalent in your program of choice):
It is a simple matter of adding a black layer to get to the desired result:
Note: depending on the original image type, you will need to convert your image to RGB mode in order to support transparency (otherwise the “Color to Alpha” menu command will be disabled).