
:max_bytes(150000):strip_icc()/gimp-erase-frame-138c7cb684944b55871e18ed389da64f.jpg)
However, unless used carefully, it does have a tendency to produce output that is rather more transparent than you'd probably want it to be. for the whole image), which is useful for reconstructing transparency when you have only one version of the image on a solid color background. GIMP does also have a "Color Erase" feature (as a blend mode for the Bucket Fill tool, or as Color to Alpha. The amended instructions should work with backgrounds of any color, as long as they're solid colors.) If the backgrounds are a little bit off, similar methods may still be usable, but you may need to do additional color adjustments and the results may not be as perfect. Of course, this technique really requires that you have versions of the image on pure black and pure white backgrounds. And there you go - one reconstructed transparent PNG ready to go: Finally, to turn the mask into a proper alpha channel, you can apply it (but GIMP's PNG export will do that for you even if you don't).

The result should now look more or less like the original transparent image. Now, add a layer mask to the resulting layer, select the mask and paste the alpha layer into it. The result should look like this (compare with the original black-background version to see the difference): To do that, clone the alpha layer we created in the previous step (or just copy it to the clipboard), set its layer mode to "divide" and merge it down with the black-background layer your cloned before step 2. But since we aren't, we still need to de-multiply the RGB channels. If we were using an image format with pre-multiplied alpha, we'd be more or less done now. This should subtract away the original background, leaving you with the image on a black background. Finally, change the resulting layer's mode to "subtract" and merge it down onto the layer with the original image.Place this layer on top of the new solid-color one you just created, set its layer mode to "multiply" and merge it down. Clone the difference layer and re-invert it so that it has a white background.Create a new layer on top of it filled with its background color. Pick whichever original version has the darker background.To do that, use the following extra steps: If you don't already have one, you also need to create a version of your image with a black background for the next step. ( Normalize above works if the alpha channel you're recreating has at least some parts with 100% opacity if the image you're recreating is everywhere translucent, you can use Colors → Levels. You could also use the Channel Mixer instead, but it's a little trickier to use. To fix that, first desaturate the layer (using whichever mode that gives you the best contrast) and then use Colors → Auto → Normalize to make the background black. This gives you the alpha channel of the original image.Įdit: If your backgrounds are not black and white, the inverted difference layer won't have a black background. Take the difference of the layers: clone the black layer (you'll need it later), change the white layer's layer mode to "difference" and merge it down.

The two layers should looks something like this: Move the white layer above the black layer if it's not already that way. or just open both and copy-and-paste one into the other). Open the black and white background versions as layers of the same image (using Open as Layers. Let me outline how it's done, using this image from Wikimedia Commons (by ed_g2s, licensed as CC-By-SA 3.0) as an example:
