How do I define or deselect areas where the "Color to Alpha" effect should not be applied?


I have an image where the background is white and there are various important components that are also white. I want to just change the background to alpha, but "Colors to Alpha" - by default - changes all the white to alpha.

Please help and thank you!

8/26/2015 12:16:00 AM

Accepted Answer

If the image is in a single layer, select the areas you want to go transparent with the "Magic Wand" (Fuzzy Select) tool instead.

Them just Edit->Cut to get rid of the selected parts. (Make sure your background layer has an alpha channel Layer->Transparency->Add Alpha Channel).

If your background is in a different layer, then just delete/hide that layer.

8/26/2015 1:30:00 PM

If you have an active selection, Color to Alpha will only affect the selected parts of the image. Thus, you just need to select the background (e.g. with the Magic Wand tool) and then apply Color to Alpha, leaving the un-selected areas untouched:

OriginalSelectionColor to AlphaResult
(Original image by Creative Tools, used under the CC-By-SA 2.0 license.)

See Making the background of an image transparent in Gimp for a more detailed step-by-step explanation, from which the sample images above are taken.

(Of course, if you don't wish to preserve any shadows or reflections in the background, then you can simply Cut it away instead, as jsbueno suggests in his answer.)

There are several variations on this technique that will let you fine-tune the selection afterwards. One is to make two copies of the layer you're editing, convert the selection to a layer mask on the upper copy, and apply Color to Alpha to the (entire) lower copy. This way, you can edit the mask to fine-tune the border between the opaque and semitransparent parts of the image.

Alternatively, you can create a pure white layer (with an alpha channel) under the layer you're editing, cut out the selection from this white layer, and again apply Color to Alpha to the entire image layer. Again, by painting and/or erasing the white layer, you can adjust which parts of the image should be opaque. One potential advantage of this method, if you intend to place the resulting shape over a specific background, is that you can also paint other colors onto the lower layer to help it blend with the new background.