PDA

View Full Version : maths behind photoshop's blending modes


Ch3
03-25-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?

ThE_JacO
03-25-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.

Segmoria
03-26-2005, 06:00 AM
You might wanna have a look at this site here > http://www.pegtop.net/delphi/blendmodes/
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

Ch3
03-26-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!

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

neutronic
03-27-2005, 02:15 AM
**sorry wrong post :)

Ch3
04-09-2005, 03:07 PM
any idea for the color operation?

pekko
04-09-2005, 04: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:

Ch3
04-10-2005, 01: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.

Segmoria
04-10-2005, 02: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.

Segmoria
04-10-2005, 02: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.

SteveV
04-10-2005, 07:47 AM
Photoshop has add and subtract in it's channel calulations and apply image functions.

Per-Anders
04-10-2005, 08:40 AM
Here, this should be all the information you require (and then some):

http://www.pegtop.net/delphi/blendmodes/

Ch3
04-10-2005, 11: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-10-2005, 11: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.