Adjusting aperture alone can only do so much to get sharp images with a wide depth of field — sometimes, getting both point A and point B tack sharp in one shot is about as possible as a flying pig. This is particularly true for macro photography. But just like high-dynamic-range composites use multiple exposures to capture an otherwise impossible range of light, there’s a photographic trick that can capture impossibly sharp images: Focus stacking. Focus stacking is both a shooting and an editing technique that works together to create a shot that’s much sharper than the one you could achieve in camera, and beyond a tripod and a copy of Adobe Photoshop, it doesn’t require any specialized gear.
Essentially, focus stacking can help you get a deeper depth of field without resorting to microscopic aperture sizes that can actually soften your image due to diffraction. It also allows you to maintain the blurred background of a large aperture, while keeping your subject completely in focus. In our sample photo, adjusting the aperture to get both rings sufficiently sharp resulted in losing the soft background. Focus stacking solved the problem in a matter of minutes. Here’s how you can achieve this effect for yourself.
What is focus stacking?
The technique plays with depth of field, which determines how much of the image is in focus. Focus stacking can be used in a number of different types of images, but the trick is most common for macro photography because getting up close creates a shallower depth of field (i.e., only a small portion of the image is sharp).
Focus stacking merges multiple photos together that were taken at different focus distances. In the most basic sense, one image will focus on the closest point of the subject, the next in the middle, and the next on the farthest point — although many more images may be used to fill in the gaps. When those photos are merged, the result is an image with a much deeper depth of field than the original. Focus stacking can be used if the scene is too dark for a narrow aperture, or when a narrow aperture still isn’t enough to achieve a sufficient depth of field.
How to use focus stacking to get sharper shots
1. Choose your scene and stabilize the camera.
Focus stacking requires layering several images over each other — a task that’s much easier to do when your camera doesn’t move between frames. Ideally, once you’ve decided on your composition, you should set up a tripod to keep the camera in place. Any way you can keep the camera steady is fine, however — in our example, the camera was resting on a table.
Note that the editing process often requires slight crops, so compose the shot a little wider than you’d like so you can avoid cropping out any important areas of the image.
2. Set your exposure.
Any time you are merging photos together, you don’t want the exposure to change between shots (unless, of course, you are shooting HDR). Use manual exposure mode to keep the exposure consistent between shots. Merging the photos will be easier if you start with an aperture at least partially stopped down, to pull out as much depth of field as you initially can. Again, however, lighting and diffraction may limit this.
On the other hand, if you want to keep the background as soft as possible, use a wide aperture and rely solely on focus stacking to add the extra sharpness — just note you’ll need to take more photos at more focus points to do this. You should also avoid auto white balance, as it may shift slightly from one exposure to the next.
3. Focus on area No. 1 and shoot.
With your camera secure and the exposure set, change your focus area to single-point autofocus so you can choose where the camera sets the focus. Focus on the frontmost part of the subject and take a photo. If you’re comfortable with it, we recommend using manual focus and live view (where you can punch in on the preview image to check focus), which will give you even greater control.
4. Continue shooting, adjusting the focus each time.
Next, repeat the previous step, moving the focal point each time, until you have photos with every section sharp. The number of shots you’ll need to merge depends on the subject and your aperture settings. Take a look at the previous shot, determine where the sharpness falls off, then place your focal point so that the sharp area will overlap with the previous sharp area (or, in manual focus, simply continue rotating the focus ring by a small amount between frames). If you don’t overlap the sharp areas, your final image could have a sharpness that wanes in and out, so err on the side of taking too many photos rather than too few.
5. Open and align in Photoshop.
Editing is where the magic happens — and merging those images isn’t as complicated as it sounds, thanks to a few automated tools. First, you need to open all the files as separate layers in Photoshop. The simplest way to do that is to go to File > Scripts > Load Files Into Stacks and choose your files in the pop-up window. Check the box that says to attempt to auto align images, since even with a tripod you can sometimes have slight offset between shots. (If you’re also using Adobe Lightroom, you can select all the images, right click, and choose to open all the files in Photoshop. In the dialog box for stack options, select the box that says to include all the open files.)
You should now have a stack of aligned images. Next, you’ll blend them together.
There are multiple ways to merge your focus stack, an auto option — which works most of the time — and a manual option that offers more control.
To let Photoshop automatically merge your images, go to Edit > Auto-Blend Layers. If you have slight white spaces on the edges you can check the box that says “content aware fill transparent images” or you can crop them later. Also check the box for seamless tones and colors and select the “stack images” option (not the panorama). Click OK, wait for Photoshop to do it’s magic, and then voila! A sharp focus stack.
Sometimes, however, the auto option doesn’t cut it — as was this case in our example image. Because the bokeh in the background was created from an out-of-focus flame, it was different in every frame, creating what’s called ghosting where the images don’t perfectly line up. To correct this, you can manually choose which portions of each layer to include in the final shot, rather than using the automated option.
Make sure the layers are aligned so that the focal point that’s the closest to the camera is on top. Next, use the eraser tool on each layer to erase the areas that aren’t sharp in that photo but that are sharp in the next layer or layers. Then, move to the next layer and repeat. By selectively erasing portions of each layer, you can choose which portions of the image should remain sharp. If you get lost in all the layers, use the eye icon to remove other layers to see exactly what you are working on.
Once you’re happy with the results, you can merge the layers down into one file and continue with any other edits. To keep the colors consistent when exporting the file, check the boxes for SRGB and embed color profile, otherwise the image’s colors and exposure may appear a bit different when viewed on the web.
Focus stacking allows photographers to work around the limitations of depth of field and create images that would be impossible to capture otherwise. The technique is excellent for getting sharper macro shots but can also be used in other areas, including landscapes with a lot of range from foreground to background, where a small aperture may be undesirable due to diffraction. Focus stacking is an advanced technique, but thanks to modern tools, it is actually pretty easy to pull off if you don’t mind putting in a little time.