Important notice!

We are currently unable to offer compatibility or technical support for our plug-ins.

You can still download the free plug-ins, try out the demo plug-ins and purchase licenses and we do provide administrative support (i.e. providing downloads and missing license information).

Make sure to try out the demo of the plug-in you want before purchasing a license for it.

Mixing modes

PhotoShop has a number of standard methods for mixing colors which allow you to combine two layers to create beautiful effects. As just about every PhotoShop users use these mixing modes in one way or the other you can use these modes to easily enrich your own FilterMeister plug-ins with them. Most of these modes are quite difficult though so that why we're publishing most of them right here.

We will only show the code for one color channel, this code is identical for each channel.  For the purpose of this tutorial we'll move the content of the mixing into a variable named "color". Since a mixing mode requires two source channels and the effect changes when these are exchanged we will give the two channels the names "bottom" and "top".

Normal
color = top

Dissolve
Requires an alpha channel.

Multiple
color = ( bottom * top ) / 255

Screen
color = 255 - ( ( 255 - bottom ) * ( 255 - top ) ) / 255

Overlay
color = bottom < 128 ? ( 2 * bottom * top ) / 255
                     : 255 - ( 2 * ( 255 - bottom ) * ( 255 - top ) / 255 )

Soft light
The soft light algorithm is not perfect yet.

Hard light
color = top < 128 ? ( 2 * bottom * top ) / 255 
                  : 255 - ( ( 2 * ( 255 - bottom ) * ( 255 - top ) ) / 255 )

Color burn
color = top <= 0? 0 : max(255 - ((255 - bottom) * 255 / top), 0)

Color dodge
color = top >= 255? 255 : min(bottom * 255 / (255 - top), 255)

Darken
color = min( bottom, top )

Lighten
color = max( bottom, top )

Difference
color = dif( bottom, top )

Exclusion
color = 255 - ( ( ( 255 - bottom ) * ( 255 - top ) / 255 ) + ( bottom * top / 255 ) )

Hue
This mixing mode requires RGB to HSL and HSL to RGB conversion.

Saturation
This mixing mode requires RGB to HSL and HSL to RGB conversion.

Color
This mixing mode requires RGB to HSL and HSL to RGB conversion.

Luminosity
This mixing mode requires RGB to HSL and HSL to RGB conversion.

Note that all code above has been thoroughly tested and, to the best of my believe, produce results identical to their PhotoShop counterparts. Most of these modes were copied or based on the work of Ilya Razmanov (a.k.a. Ilyich the Toad), Werner D. Streidt and some others. You can find them, along with myself, on the FilterMeister Mailing List.