View Full Version : maths behind photoshop's blending modes

03 March 2005, 01:01 AM
Anyone knows the algorithms for the different blending modes you can have in photoshop's layers?

I know multiply is A*B for example and screen is 1-((1-A)*(1-B))
but what about the others like ColorDodge, darken etc?

03 March 2005, 01:30 AM
don't quote me on what follows, these concepts come from my very diminutive comp background, but probably they apply:

things like multiply and screen fundamentally rely on formulas that will not exceed the 0-1 scale.

linear dodges and burns (not an exclusive of photoshop name wise) add and subtract colors directly and clamp whatever is out of the 0-1 range, other dodge&burns usually act in a similar fashion but before the clamping they transform the value by multiplying it for some kind of curve, so that the distribution of the gamma is modified.

the other ones like soft light and hard light I wouldn't know, but considered the limited amount of thing you can do with 2 raster layers, when these things need to work with brushes as well, I guess they do justabout the same with different curves again.

03 March 2005, 06:00 AM
You might wanna have a look at this site here >
It has a couple of formulaes for the specific blending modes that you're looking for

Though the more interesting ones are always those resulting from your own rather randomy non-sense experimentations :P

03 March 2005, 11:02 AM
Segmoria that's exactly what I was looking for. It has ever more stuff...
and yes I agree with you, it's all about experimenting with those things.

thank you very much for the link dude!

03 March 2005, 01:42 AM
if you want more, ask anyone who develops for the gimp. I am sure they would know too.

03 March 2005, 02:15 AM
**sorry wrong post :)

04 April 2005, 02:07 PM
any idea for the color operation?

04 April 2005, 03:35 PM
Why there are no ADD mode in photoshop....???? It should'nt be so hard to put there...even i could do it..just show me the code :sad:

04 April 2005, 12:00 AM
yea it would be nice.
But even if photoshop had add or subtract, it would be pointless in most of the time as the colours are always clamped to 0-1 range. I mean most of the times I use add in shake or maya, I have to scale the range so to fit it inside 0-1.
What i don't understand is why 16bit images are not fully supported even in the latest version.

for the color operation I multiplied the two images together using a mask, made by a very low Gamma version of the first image.
It gives almost the same results but I hope to find out the proper equation.

04 April 2005, 01:29 AM
Why there are no ADD mode in photoshop....???? It should'nt be so hard to put there...even i could do it..just show me the code :sad:
isn't ADD a simple boolean AND boolean operation?
so lets say if you have a pixel of RED 120 in one pic and 40 in the other, the result will be 160.

04 April 2005, 01:53 AM
As for the COLOR one, according to the GIMP documentation its: R=[h(F),s(F),l(B)]
Which is easy to figure out, since the result combines the luminance of the background with the saturation and hue of the foreground image.

04 April 2005, 06:47 AM
Photoshop has add and subtract in it's channel calulations and apply image functions.

04 April 2005, 07:40 AM
Here, this should be all the information you require (and then some):

04 April 2005, 10:40 AM
Segmoria - thanx a lot for that. It worked fine.

SteveV - yea i havent used those calculations before, and they seem to be handy. thanx for that.

mdme_sadie - this link was already given a few replies above, but thanx anyway

CGTalk Moderation
04 April 2005, 10:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.