Image alignment and analysis with Difference Blending
Way back when we started our journey through the dark and forbidding lands of Photoshop Blend Modes, I showed this chart, grouping the blend modes into some distinct categories:
If you look closely, you’ll notice that there are a couple in the middle that don’t fit into the other categories, and today we’ll take a look at one of them: the Difference blending mode. As the name implies, this mode is useful for finding the “difference” between two layers, but it also has some creative uses as well. In this tip, we will focus on the more utilitarian purpose, and see how Difference mode can help us to align and analyze images.
First, a bit of an overview of what difference mode does. It compares the colors of the current layer to those below, and subtracts the two to arrive at a resulting color. This has three special secret effects:
- Blending with pure white as the color will completely invert the image. This provides the same result as using the Image > Adjustments > Invert command.
- Blending with pure black as the color has no effect at all. Recall that black pixels have a tonal value of 0, so subtracting 0 makes no change.
- Blending two identical colors together will result in pure black. Since the values are the same, when subtracted, the result is 0, which is the value of black.
We can see this in action below. We’ll start with this image:
Now, let’s add a new layer, with a simple black to white gradient. Change the layer’s blend mode to “Difference” and you can see that the white part of the gradient has inverted the image, while the black part has left the image unaffected:
This demonstrates special effects 1 and 2 from above. Now let’s look at special effect #3.
First, we delete the gradient layer. Then, duplicate the background layer and set the duplicate to “Difference” blend mode:
Notice that, although you can clearly see the images are the same in the layers panel, the net result of subtracting the two (Difference mode) is that the entire image turns black. The main point to realize is that this happens because EVERY pixel is the SAME.
What if we take the move tool, and nudge the top layer to the right a few pixels? You can do this my selecting the Move tool (V) and using the arrow keys to nudge one pixel at a time. Notice that even with a move of one pixel, there is a noticeable change. Take a look:
You might start to see where I’m going with this: you can use this feature to line up layers, one on top of another, by nudging them into position. Modern versions of Photoshop (with Photomerge) have some pretty sophisticated stitching capability, so this isn’t always as useful as it once was. But it can still get you out of a bind, and it works on any document regardless of how many layers you have.
For example, I worked on a project recently in which I was scanning in an entire front page of a newspaper – a 30-year-old newspaper, brown and aged, with creases, dust, you name it. Now, my scanner isn’t the size of a full newspaper, so I had to do it in segments. And, with the sad condition of the paper itself, Photoshop’s Photomerge feature wasn’t cooperating – so, I had to stitch by hand.
Here’s a view of a couple of layers I was trying to align:
You might be tempted to lower the opacity, but that’s really hard to see. Let’s change the upper layer to Difference mode (temporarily):
Notice how in the overlapping area, you can see both layers, and you can see that they are not aligned. Grab that move tool, and get a rough alignment by dragging the top layer:
Notice how the closer you get to alignment, the more areas turn black? No, it’s time to switch to the arrow tool and start nudging one pixel at a time:
You’ll know you have the best possible alignment when a one-pixel nudge in any direction results in more color appearing. You’ve reached the center of alignment (don’t forget that some images might require rotation or resizing to get the alignment perfect). Once your image is in alignment, simply change the blend mode back to “Normal.”
One last tip for today: you can use this not only for alignment, but for analysis. Recall our image from a few weeks ago when we looked at softening with Overlay:
What if we wanted to do a quick check to see where we made our modifications and retouches on this image? We simply duplicate the original, bring it to the top of the stack, and set the blend mode to “Difference:”
Now the differences are visible, but at this resolution, and without a good monitor, it is really hard to see! Can we do something about it? Of course!
Let’s add a new layer to the top. Fill it with white, then set the blend mode of the new layer to “Color Dodge.” BOOM! The lighter areas are amplified and it is easy to see where we made our retouches from the original image:
I hope you found today’s tip useful! Stick around for next week, when we will explore some of the more artistic ways of using Difference blending mode.
Leave a comment