The Dual Key Effect

Video editing and websites make extensive use of pictures with an alpha channel which makes a part of the picture transparent. The pictures are artwork like logos, title elements and are most often created with a picture application that supports alpha channels like Photoshop and saved as PNG (or TIFF or Targa).

There are however occasions, where you cannot create the picture with an application that supports alpha channel. You maybe want to create your artwork in Pages or another page layout application or you may have an automatic workflow where the artwork is created from a database that cannot create pictures with alpha channel. If this is your case, then the Dual Key Effect is a solution for you.

There have been several existing methods to create an alpha picture, like the luma key or the color key, but they all have two problems: The key color might be within the artwork and the border rendering is not perfect. The Dual Key resolves this problem.

What you need: You have to create the artwork twice, once before a white and before a black background. (We said that you created the artwork, so you can set a background, can't you?). The Dual Key Effect analyzes the difference between the two pictures and creates both the original RGB and the alpha channel of the artwork.

It does this by simple math. The general formula for the alpha channel is this one

(1) y = fg * a + bg * (1- a) 

Where a=1 is opaque and a=0 is transparent.
As in the picture with the white background the background is 1 and in the picture with the black background the background is 0, we have these formula

(2) yw = fg * a + 1 - a
(3) yb = fg * a

Therefore we can say

(4) yw - yb = 1 - a 
(5) a = 1 + yb - yw

And we can also calculate the foreground

(6) fg = yb / a  = yb /(1 + yb - yw)

The application Dual Key Effect demonstrates the effect. You can drag the white and the black picture (PNG) and save the transparent PNG.



Download application
http://www.belle-nuit.com/download/dualkey100.dmg

Works with MacOS 10.7 and later. Right click to open first time in 10.8.

23.11.2012