Page 1 of 1

Retrieve original transparency from a PNG

Posted: 2009-07-03T03:29:59-07:00
by badabou
Hello,

I need your help experts.

I try to find the original transparency of a PNG image which has been replaced by an opaque color.


Here is an example :

The first image is the original image (with a nice gradual transparency) :
Image


The second is the image where there is no more transparency because the green (#00ff00) has replaced it.
Image


How to get the image 1 when I only have image 2 ? Is that possible with imagemagick ?

Thank you very much

Re: Retrieve original transparency from a PNG

Posted: 2009-07-05T23:29:48-07:00
by anthony
This problem is one of the most basic problems I have, and one I have not yet solved.

Though I do try to make it easier on myself by having one image overlayed on black, and the other on white, Or at least any two colors that are reasonably separated. With the two different backgrounds a reasonable deduction of the alpha channel could be determined. With a reasonable alpha then the real color of the pixel should also be determinable. -- However I have not got a final solution for this!

However you only have ONE color! And with that, it is simply imposible to determine what is green, and what is transparent! Let alone how much green from each pixel was transparent!
Their is just not enough information for each pixel!

Really I have no good solution for this. As such I am very much open to suggestions.