|Ned Batchelder : Blog | Code | Text | Site|
Photoshop blend mode math
» Home : Blog : June 2008
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.