Join Deke McClelland for an in-depth discussion in this video Photoshop's blending formulas, part of Photoshop Masking and Compositing: Advanced Blending.
All right, gang! Now we are going to actually get into the underlying arithmetic formulas that are associated with the blending operations here inside Photoshop. And we're going to take it pretty easy because there's an awful lot of stuff going on, even if you like math, by the way. The file I have open is called Blend mode math.psd, it's found inside the 02_math folder and you can see that we've got the blending functions listed over here on the left hand side, the pixel formulas are listed here in the middle and then I've also provided a description of each one of the formulas, because it's very possible that you might look at A+ B-1 and think, all right, but I don't have any idea what in the world that would possibly mean.
So we'll walk through all of them here. Now I have tried to document every one of the blend modes, with the exception of four. Normal and Dissolve, because they don't use any special math, and then Lighter Color and Darker Color which are composite modes that are based on Lighten and Darken respectively and we'll see how they work later. And then finally, despite a lot of research, I was not able to verify the formula for Soft Light. None of the formulas that I found out there actually worked the way the Soft Light blend mode does.
Anyway, with that in mind here's what's going on with every single one of these formulas. They are based on the letters A and B . A represents a pixel on the active layer, B represents that same pixel on the underlying layers that is to say in the background. So A is active, B is background and that's really all there is to that. Notice also over here where the descriptions are concerned, I have this little caution icon. Any of the blend modes that include those caution icons may and probably will result in some degree of clipping; either you'll be clipping to black or to white.
Any of the blend modes that do not include caution icons can not clip. They will not introduce any form of clipping, so they turn out to be the safest and typically the most useful modes. We'll start off here with the basic Opacity formula. I've re-showed you this one at the beginning of Chapter 2 of my masking and compositing fundamentals course, but let's go ahead and review. You may recall that Opacity is represented by the Greek letter alpha which is where the alpha channel gets its name.
And so to calculate Opacity, you multiply that Opacity value and you would standardize it as well. So 100% Opacity would be 1, 0% opacity would be 0, 50% opacity would be 0.5, and so forth. So you multiply the active pixel by the Opacity value and then you take 1 minus that Opacity value, 1-a, which is the inverse of the Opacity value. Any time you see 1 minus anything in these pixel formulas that means you're finding the inverse and in this case, we're multiplying the inverse of the Opacity value by B that is that background pixel.
So if the Opacity was 70% it'd be 0.7 times A and then 1-0.7 would be 0.3 for 30% B. So it'd be 70% of the active layer with 30% of the background layer; pretty easy to figure that one out. And all it is, is a percentage based pixel mix. It's as if we are mixing a beverage, let's say; it's 70% one ingredient and 30% of another. All right! Now let's take a look at the first darkening mode which is Darken. All it does is locate the darkest pixels.
So in other words, where any single pixel is concerned, it tries to find the minimum. So if A is darker then A wins and if B is darker B wins. Whichever pixel is darker is the pixel that you end up seeing after you blend the images together, which means, you end up getting a lot of harsh transitions, not one you'll be using on a regular basis, but still, there it is. Multiply as I was saying totally great mode incapable of clipping as you can see over here, no warning. And all it does is multiply the two pixels together.
We saw how that worked in a previous exercise, the product of that equation evenly darkens the composite image. Now I'm also including just one mode as it relates to interacting with the Opacity value, because I want to give you a sense of how that works. So let's say, we're multiplying the active layer and we're setting it to say 70% Opacity. In that case, we would start things off by taking the product of the two images, so we would multiply them together, and then Photoshop would treat that as a composite version of the various layers and it would multiply alpha times that composite and then mix it in with 1-a of the background.
Notice there is nothing special going on here. That (1-a)B is the same as it was when we're working with the Normal Mode, let's say. So as a result, we would have, in our case, 70% of the multiplied image blended in with 30% of the background image and so we get a translucent product and that's the way it works across the board. So any time that you're mixing in Opacity along with a blend mode, you were multiplying the Opacity value times the blended image and mixing it with the opposite of the Opacity value assigned to the background.
That gives you at least an introductory sense of how the math works where blending is concerned with Photoshop. In the next exercise, I'll show you more.
- Assembling dynamic Dissolve effects
- Filling and stroking with Behind and Clear
- Cleaning up and compositing scanned line art
- Understanding the darken, lighten, and contrast modes
- Refining a mask with Multiply and Screen
- Creating a glowing, soft-focus effect
- Blending images with textures
- Comparing two seemingly identical images
- Creating type that inverts everything behind it
- Colorizing artwork with layers
- Achieving greater control with the Blend If option