Join

Formulas for Photoshop blending modes

Posted: April 21st, 2010

Do you want to apply one of the Photoshop blending modes to two images but using a PixelMath-like tool? Here's a list of the current Photoshop blending modes and their equivalent PixelMath formula that I could find. While some of the formulas are precisely what Photoshop does, others are just an approximated guess. Also, blending modes that cannot be achieved by a straight PixelMath operation - such as Luminosity, Hue or Color - are excluded:  

Blend mode Commutativity Formula Addtl .info
Darken commutative R = min(Target,Blend)         
Multiply commutative R = Target x Blend         
Color Burn non-commutative R = 1 - (1-Target) / Blend         
Linear Burn commutative R = Target + Blend - 1         
Lighten commutative R = max(Target,Blend)         
Screen commutative R = 1 - (1-Target) x (1-Blend)         
Color Dodge non-commutative R = Target / (1-Blend)         
Linear Dodge commutative R = Target + Blend         
Overlay non-commutative if (Target > ½) R = 1 - (1-2x(Target-½)) x (1-Blend)
if (Target <= ½) R = (2xTarget) x Blend
A combination of multiply and screen.Also the same as Hard Light commuted
Soft Light non-commutative if (Blend > ½) R = 1 - (1-Target) x (1-(Blend-½))
if (Blend <= ½) R = Target x (Blend+½)
A combination of multiply and screen(The formula is only approximate)
Hard Light non-commutative if (Blend > ½) R = 1 - (1-Target) x (1-2x(Blend-½))
if (Blend <= ½) R = Target x (2xBlend)
A combination of multiply and screen. Also the same as Overlay commuted
Vivid Light non-commutative if (Blend > ½) R = 1 - (1-Target) / (2x(Blend-½))
if (Blend <= ½) R = Target / (1-2xBlend)
A combination of color burn and color dodge
Linear Light non-commutative if (Blend > ½) R = Target + 2x(Blend-½)
if (Blend <= ½) R = Target + 2xBlend - 1
A combination of linear burn and linear dodge
Pin Light non-commutative if (Blend > ½) R = max(Target,2x(Blend-½))
if (Blend <= ½) R = min(Target,2xBlend))
A combination of darken and lighten
Difference commutative R = | Target - Blend |         
Exclusion commutative R = ½ - 2x(Target-½)x(Blend-½)

:: 2 Comments

Comments

david (Contact, Page), February 23rd, 2011, 9:33
I tried the 'overlay' method in pixelmath, and even substituting '*' for 'x', and 0.5 for 1/2 it throws an error!

RBA (Contact, Page), February 23rd, 2011, 23:32
David, I should've made clear that the expressions aren't meant to be entered exactly as I indicated. Each software may have a different syntax depending on their particular PixelMath implementation.

For PixInsight, it would be something like this:

(($T > 0.5) * 1 - (1-2*($T-0.5)) * (1-BI)) ($T <= 0.5) * (2*$T) * BI

Where BI is the blending image.
Also note that all the expressions that use "if..." are approximate.

Post a comment
Your name:
Email: (it won't be sold or made public, ever!)
Your web site: (if you have one)
Comment:


(you have 1000 characters left)

Home | Articles/Blog | Tutorials | About me | My equipment | Favorite locations | Other sites

DeepSkyColors is licensed under a non-commercial, non-derivative Creative Commons License.
See required attribution line here
For commercial use of my images, please contact me.