Photoshop blend mode math

Saturday 7 June 2008This is over 16 years old. Be careful.

I’ve used Photoshop and Gimp to do simple image manipulation, and have always been fascinated and baffled by the blend modes, those mystifying choices for how to combine two layers in an image. Dodge? Burn? I could choose them and see what happens, but what I really wanted was to understand them.

Nathan Moinvaziri has concisely summed up the blend modes in the form of C macros: Photoshop Blend Mode Math. I don’t know if it really helps to see Dodge defined as:

#define Blend_ColorDodge(A,B)	((uint8)((A == 255) ? A:((B << 8) / (255 - A) > 255) ? 255:((B << 8) / (255 - A))))

but it at least gives me another way to look at the whole concept.

One of Nathan’s sources for the basic information was Paul Dunn’s Insight into Photoshop 7.0 Blending Modes, which has visual aids and a more traditional math notation.

Comments

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.