Photoshop Proving Ground
Difference Blending Mode
While I’ve used Difference quite a bit in the past, what made me decide to write about it here was a video recently published by Unmesh Dinda of PixImperfect. He has a clever trick where a sample from each of two skin tones is used to create an intermediate color. That intermediate color – the difference between the tones – is used as a kind of translation. You can apply it to either skin color and with a little blending trickery, you end up with the other one.
It’s a neat application to be sure, and Unmesh shows a little math to demonstrate the concept. The problem is, it only works in a specific case. He uses Linear Dodge (Add) and Subtract blending modes rather than Difference, but the principle is the same. Like most blending modes, Difference operates independently on each of the three color channels. It compares the gray values between two layers on each channel and returns the absolute value.
Consider a simple calculation: 150 – 100 = 50. In this case, the top layer has a gray value of 150, the bottom of 100. The difference is 50, which we can get by using Subtract blending. To convert the top layer’s gray value of 150 to 100, you simply subtract 50. To convert the bottom layer’s gray value of 100 to 150, you add 50. Easy, right?
The problem is when all three RGB values are not greater or less than their counterpart on the other layer. Think about this:
Layer 1: RGB (150, 110, 40)
Layer 2: RGB (100, 100, 100)
Layer 1 – Layer 2 = (50, 10, -60) || Layer 1 + Layer 2 = (250, 210, 140) || ABS (Layer 1, Layer 2) = (50, 10, 60)
Three different results, none of which can be used as a direct translation from one color to another. Worse, when using Add or Subtract blending, you can get numbers outside of 0-255, meaning those values are clipped. The -60 Green value becomes 0.
So the trick only works when the two colors have a systematic offset – they have to be consistently brighter or darker on every channel, and the values cannot be clipped. For skin tones, this mostly works, but you still risk shifting colors unless you check in advance. And by the time you’ve done that, you can easily just apply a gradient map or even a solid color blend to replace one for the other. I also have a tutorial describing how to use Curves to match overall color theme in an image, not just skin tones.
In the end, the color match trick is just that – a trick. It is indeed clever, but I feel like it works as an exception, and not a rule.