Focus stacking is a technique to increase the depth of field in your macro photos. The process is straightforward, requiring a combination of camera technique and Photoshop to deliver the results.
Take a series of pictures with small changes in the focus distance for each frame. Then use Photoshop to group the pictures into layers and select the sharpest bits of each frame to create an image with enhanced depth of field.
This might sound tough, but Photoshop has tools to automate much of the post processing, so you can concentrate of preparing the right shots.
Image quality improved with focus stacking
The quality of your images, depends on the lens. All lenses start to become softer when the aperture is closed down towards the maximum. This is due to an optical effect known as diffraction.
Focus stacking example – strawberry
I used the Canon EF 100mm f/2.8L Macro IS USM lens to take a series of just four shots to illustrate the focus stacking process. I put the camera on a solid tripod, and used the Canon EOS Utility software to remotely control the camera and lens. Use EOS Utility to drive the lens focus from your computer keyboard. Using Live View makes this simple. Doing it this way also avoids movement of the camera that can occur if you have to turn the focus ring on your lens.
To show the effect clearly, I shot pictures with the lens wide open at f/2.8. In practice you would stop down to around f/8, as this is where most lenses have their maximum optical performance. Focus stacking helps when you are working at, or near to, 1:1 magnification. A nice side effect of shooting at f/2.8 is that any sensor dust spots are just about invisible too.
I used flash for this example, and manually set the camera exposure. Flash also adds to the sharpness due to the short duration of the flash illuminating the subject.
Here’s my four individual shots at f/2.8
Preparing your photos for focus stacking
Once you have your images, you need to open them as layers in a single file. You can automate this from Lightroom or Photoshop. I used Lightroom, and then aligned the images in Photoshop
If you don’t use Lightroom, then in Photoshop, go to File > Scripts > Load files into Stack to load files.
Choose the option to automatically align the photos in the dialog box. Many lenses will change magnification as focus moves, which results in slightly different sized pictures. Photoshop will align and resize images as needed for you.
If you used Lightroom to load the images to layers, select all the layers and then go to Edit > Auto-Align Layers. In the dialog box select the AUTO option for the projection.
Focus stacking made simple in Photoshop
You could laboriously identify the sharp bits of each layer and add a layer mask so that only that showed in your photo. Or you use the tool I did, auto-blend the layers. Make sure all the layers are selected and then go to Edit > Auto-Blend Layers to bring up the blend dialog. Make sure that Stacking, and Seamless Tones & Colours, are selected.
Once Auto-Blend completes, you have a file where each layer has a mask to show only it’s most focussed parts. Remember that for high resolution images and lots of layers this can take some time and computer power.
To the left you can see the result. Of course you can now go in to each layer and use the brush tool to make any adjustments needed.
Focus stacking works
This is the result, comprised of four photos with each one shot at f/2.8 on the EF 100mm f/2.8L Macro IS USM lens.
Equipment for focus stacking
- EOS camera – EOS 7D Mark II
- Macro lens – EF 100mm f2.8L Macro IS USM
- Tripod – Manfrotto 055 Carbon
- Computer with EOS Utility – included with EOS cameras
- USB cable (or wifi connection if your camera has one)