De-alpha blending

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
thefcpk
Posts: 2
Joined: 2013-08-23T03:52:00-07:00
Authentication code: 6789

De-alpha blending

Post by thefcpk »

Hi all,

I have found that a couple of my pictures I usually put a watermark on... well I only have the watermarked version now.(but in quite high quality so noise won't be a huge issue)
I have the overlay that went on them, and I know the alpha blending value.
Since alpha blending is quite simple mathematically: result=alpha*overlay+(1-alpha)*original
This means to precision/rounding/errors, you can still get original = result * 1/(1-alpha) + overlay * alpha / (1 - alpha)
This is especially true in my case since the alpha value is fairly low, so there won't be huge errors.

I can not find any way to do any custom formula/use existing ones to do that.
Any ideas?
thefcpk
Posts: 2
Joined: 2013-08-23T03:52:00-07:00
Authentication code: 6789

Re: De-alpha blending

Post by thefcpk »

and since I found a solution:
convert source.png logo.png -fx "(u-v*0.25)/(1-0.25)" original.png
(alpha=0.25 here)

:)
Post Reply