Difference isn’t quite subtract. it’s an absolute subtract. i.e. it only gives positive values. if you subtract white from black, it should give negative 255, or 0 if clipped. Difference doesn’t do this – it gives the absolute value of negative 255 – i.e. 255 or white.
So white subtract black is white, whereas black subtract white is black (or -255 super black if you’re working in floating point). If we were using difference, they’re both white.
Here’s a workaround to get a true subtract:-
******** thisLayer subtract layer X ********
effect: Compound Arithmetic
(set second source layer to layer X; set Operator to Subtract; set Operate on Channels to RGB; set Overflow Behavior to Clip; set Blend with Original to 0%)
You must make sure that the layer you are subtracting has a solid alpha channel – subtract does not observe alpha, but uses the pre-divided RGB values. If this second layer has an alpha, use a Channel -> Solid Composite over black effect, then precompose before applying the Compound arithmetic to the first layer.
______________________________________
******** thisLayer subtracted from layer X ********
effect1: Compound Arithmetic
(set second source to the layer you are subtracting this one from; set Operator to Copy, Channels to RGB, Overflow Behavior to Clip, Blend with original to 0)
effect2: Compound Arithmetic
(set second source to this layer, set operator to subtract, set channels to RGB, set overflow behavior to clip and blend to 0)
______________________________________
As above: You must make sure that the layer you are subtracting has a solid alpha channel – subtract does not observe alpha, but uses the pre-divided RGB values. If this second layer has an alpha, use a Channel -> Solid Composite over black effect, then precompose before applying the Compound arithmetic to the first layer.
For all of these, do what you like with Stretch second layer to fit, but I prefer to have both layers the same size in the first place!
http://www.benrollason.com