"Replace" image (gradient) in image with alpha
Consider the following graphic:
Note that the first image's background is transparent, and that the blue background in the second and third images is a subtle gradient - not solid color.
Basically, give the 2nd image and the 3rd one, how can I find the difference between the two to (roughly) generate the 1st image?
I'm open to any kind of answer, from "how to do it in %Program%" to "find the difference between both rgb values and multiply by..."
PS: I just realized I switched the first image with the second one in the graphic. Obviously, you start with the gradient and then put the overlay over it.
PS: GIMP has a feature called "Replace Colour with Alpha", basically, it does what I need, but it uses a specific color. In my case, the color would depend on the position.
see this article here : http://www.imagemagick.org/Usage/compose/#changemask
Basically from your two images you can call this command...
convert original.png background.png -compose ChangeMask -composite result.png
with the image with everything being original.png, the blue gradient background being background.png and the output (transparent) being result.png (or whatever you want it to be called).
You can see the result above... it successfully strips the background away, but the anti-aliasing of the items is still somewhat blue.
Maybe this is enough for you... if not things become much more difficult quickly.
The problem is that it isn't obvious with those edge pixels what colour/transparency combination they are.
There are techniques to help with this which you can read about in more details here:
But it is non-trivial to achieve as far as I know.
To get a really good result ideally you have two versions of the image sat on different backgrounds (white & black is classic) and then this technique works:
Anyway, fingers crossed the first option might be enough for your needs.