1

I have a raster graphic consisting of a solid-black icon with anti-aliased edges on top of a shaded-red background. I also have the background alone, without the icon on top. Is it possible to recover the solid-black icon alone, without the background (i.e. get the solid-black icon with its anti-aliased edges on a pure-white or transparent background)?

I tried various combinations of Photoshop blend modes and filters, but nothing worked perfectly. I think the problem is that the background is shaded instead of being a solid color. For example, using the "Difference" blend mode converts the image from solid-black-icon-on-shaded-red-background to shaded-red-icon-on-solid-black-background. Converting that to grayscale and inverting the color produces a shaded-gray icon on a pure-white background. Adding a "Curves" filter on top allows me to bring portions of the icon down to pure-black, but no matter how I fiddle with it, the result doesn't perfectly match the original when I layer the isolated icon back on top of the isolated background — the anti-aliased edges are always slightly off.

The icon with background (blown up to 800% with Nearest-Neighbor interpolation to be more visible):

Black icon on shaded-red background.

The background on its own (blown up to 800% with Nearest-Neighbor interpolation to be more visible):

Shaded-red background with no icon.

3
  • 1
    Hi. Welcome to GDSE. To be honest, I don't think it's worthwhile fixing this in Photoshop. It would be fairly easy to just redraw the graphic using vector software such as Illustrator or Inkscape.
    – Billy Kerr
    Jul 26 at 16:18
  • You can do this if you know what the background looks like. This has been discussed: here (although your case is simpler) and perhaps here (for a simpler approach). Not that i think its worth the trouble though.
    – joojaa
    Jul 26 at 17:25
  • You can do this in GIMP with the Colour Erase blending mode. Basically open the original icon image, paste the plain background to a layer on top, put both layers in a group, and set the Blending mode of the plain red background layer to "Colour Erase". Add a new filled layer under the group if you want. see example
    – Billy Kerr
    Jul 27 at 19:25

4 Answers 4

4

If you aren't trying to match the abundant anti-aliasing.... I'd just redraw the icon in a vector editor... redrawing most likley takes less time than it did to post the question here.

enter image description here

1
  • I am actually trying to preserve the abundant anti-aliasing, but thank you.
    – Lawton
    Jul 28 at 16:31
3

We actually do not know what it was originally, only guesses are possible. There's too many scalings and format conversions done.

We can try to invert the separate background and add it to the original to compensate the shading:

enter image description here

This can be flattened, desaturated and its brightness scale can be restored with curves:

enter image description here

The curve is adjusted to a straight line so that the brightest point become white and the darkest point becomes black, but the greys in the anti-alising zone stay grey.

This is the best I can get without redrawing it.

ADD1: Your attached image is 400 px wide, but it seems to contain 8 x 8 pixel blocks. I guess the original has been 50 px wide. Get it by flattening the result and scaling to 12,5% size with nearest neighbour resampling.

ADD2: Layer blendings create often unexpexted results if the blending calculations are made in the normal non-linear RGB colorspace. You can force Photoshop to calculate blendings in linear RGB by selecting in advanced color settings RGB blending to happen with gamma =1. Just in this case gamma=1 is essential, because we try to compensate brightness variations with inverted image.

enter image description here

1

@user287001 gave the solution: using the "Divide" blending mode with the background-only layer on top of the background-and-icon layer produces exactly the result I want, after correcting the dozen pixels with non-zero green and blue values. I thought I had tried the "Divide" blending mode, but I must have only done it with the background-only layer beneath the background-and-graphic layer instead of the other way around.

Copying the red channel of the divided-image, inverting it, and using it as the Alpha mask of a solid-black layer above the background-only layer exactly reproduces the background-and-icon image.

The black icon on a solid-red background.

The black icon on a transparency-grid background.

0

Unfortunately it is close to impossible to get a perfect result for the exact reason you mentioned, "...the background is shaded instead of being a solid color."

The only way to get a totally clean result is to recreate this logo from scratch either in Photoshop or better still Illustrator especially if this is something you are going to be doing on a regular basis.

If not and it's a one off I can recreate this for you if you like?

2
  • 1
    I could recreate it, but I was hoping for an easy fix. It seems like it shouldn't be a difficult thing for a computer to do, but I guess it's not built-in to Photoshop.
    – Lawton
    Jul 26 at 16:30
  • 1
    someone already suggested redrawing in another answer... Please do not repeat existing answers.
    – Luciano
    Jul 28 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.