Advertisement


Convert anti-aliasing on color to anti-alias on transparent


Question

Assume I have an icon on a pure white background in a PNG image. The icon is a solid color, with edges anti-aliased, so they are blended with white. I need to delete the white background so that the non-content is transparent. How can I get the anti-aliased edges to blend from the fill color to transparent, instead of white?

There is a similar question on the site, but this is actually a different case: dealing with solid colors, and anti-aliasing of just the edges, not reblending entire portions of the image. I don't think the answer from the other question applies. I can't reasonably apply a gradient to just the one-pixel edge of an icon. There aren't enough pixels. Also, this method doesn't scale well when the icon edges are irregular (like a Twitter bird).

Perhaps the question is whether it's possible to de-antialias an icon, knowing the foreground and background colors exactly, and to re-antialias it on a transparent background.

2014/03/12
1
4
3/12/2014 9:52:00 PM

Accepted Answer

I usually create a new alpha channel based on the selection of the color.

  1. Assuming you are starting with one flattened layer with a color on top of a white matte background. This works best if your color is dark/black. Play with some adjustments to get it as dark as possible.

    matte image

  2. Open your Channels palette and ctrl+click on the RGB channel to load it's selection, then ctrl+shift+i to inverse the selection.

  3. Press the "Create a New Channel" while your selection is still active. This will create an alpha channel for you and focus on that.

    enter image description here

  4. Go back to your Layers palette and the alpha selection should be active. Create a new layer and select the Fill tool of the color of your choice and fill in your new, matte-free single-color icon.

    enter image description here

2014/03/12
6
3/12/2014 8:34:00 PM