Focus Stacking

By Dan Burkholder Back to


Have you noticed? Photographers are combining images in all sorts of new ways. They use HDR (High Dynamic Range) to combine bracketed exposures, stitch wide panoramas with overlapping images, and shoot multiple images of a scene, changing the focus between each exposure to increase depth of field… this technique is called focus stacking.

Lens aperture is commonly used to control depth of field (DOF). In this article, I’m going to explore ways to monstrously increase DOF for landscape or macro photography using focus stacking. If you’ve dallied in HDR imaging you know that shooting a bracketed series of images−from light to dark−and using software to meld the series together, achieves an image with glowing detail from the darkest shadows to the brightest highlights Focus stacking works in a similar way, with each of the images focused at different points on the subject. After shooting the series, software melds together the sharp parts of each image.

The final image has DOF far greater than anything achievable in one shot. Focus stacking really shows its stuff with macro photography. As the camera moves closer to the subject, the DOF gets shallower and shallower. This challenge is ideal for focus stacking. Here are some examples in different shooting environments.

focus stacking, dan burkholder, photo technique
Figure 1: Simple, two-exposure focus stitch

Focus Stacking with a Simple Landscape
For the landscape in Figure 1 I shot two images, one focused on the background (panel 1) and one on the foreground (panel 2). Photoshop’s Stacking feature handled this simple near/far job with aplomb. This is a simplified version of how the two images were automatically masked by Photoshop. Nik’s Silver Efex Pro added the final touches in panel 3. Many subjects will require multiple images to supply the desired DOF. Consider these factors to determine how many images you might need for a focus-stacked final photograph:

• Subject distance. The closer the subject, the narrower the DOF and the more images needed at different focus points. For landscape photography subjects are generally at least a few feet away, sometimes extending to infinity. Close-up/macro photography also requires more exposures.

• Geometric Complexity. This geeky term refers to subjects with a plethora of detail in every axis. In my example of the fly, complexity refers to the tiny hairs protruding from the fly in every direction. This sort of detail is much harder for software to deal with.

Vibration and Mirrorless Cameras
Anything you can do to reduce vibration when shooting will make your images sharper. This is especially important for macro work where the very nature of the images−examining small detail very closely−invites intimate examination by your viewers.

Sharpness is indeed overrated but in this case you’ll impress your audience much more if fine detail is rendered faithfully. If you’re shooting with a DSLR, mirror lockup is essential (so hopefully you’re using a camera that has this desirable feature); on the Olympus OM-D, a nifty mirrorless camera that I’m

enjoying, there is a neat feature called Anti-Shock. At first I thought this was the same as using the self-timer. Was I mistaken! The Anti-Shock menu item cures about 90% of your image-degrading vibrations on the Olympus OM-D. Here’s how it works:

Mirrorless cameras have their sensors exposed anytime the camera is turned on. After all, the camera uses the sensor not just to capture the image, but to snatch the image for viewing on the back of the camera or through the electronic viewfinder (if so equipped). It’s this always-open shutter behavior that can add image-softening vibration to your captures. Here’s the sequence of events that takes place when you press the shutter on a mirrorless camera:

• The shutter slams shut. Before the camera can produce a certain shutter speed, the shutter has to close from its open/viewing position. This initial closing is the harshest movement and the one that creates the most vibrations during the exposure.

• Once the shutter closes, it opens to begin the actual exposure. This might be as short as 1/4,000 second or several minutes long, depending on the subject and illumination.

• The shutter closes to finish the exposure.

• The shutter opens one last time to return the camera to viewing/composing mode.

The Olympus Anti-Shock separates that initial closing of the shutter from the actual exposure by several seconds.

Note: You can couple Anti-Shock with your Olympus self-timer for even greater vibration dampening.

Using Photoshop CS6 to Combine a Focus Stacked Series of Images
A cliché is perfect for illustrating a point so I photographed a handy fly to show the focus stacking steps for a macro shot. I used the Olympus OM-D fitted with a Yasuhara Nanoha Macro Lens. This specialized lens doesn’t even focus to infinity; in fact, your subject must be between .75″ and 1.0″ from the front element.

To capture the series with different focus distances, I needed to−obviously−change where the camera was focused in each exposure. This is accomplished by simply refocusing the lens (as in the landscape image) or by shifting the camera/lens assembly fore and aft. For this method, it’s better to use a focus rail that precisely allows for the movement.

focus stacking, dan burkholder, photo technique
Figure 2: Seventy-two images of a fly, with varying focus points
focus stacking, dan burkholder, photo technique
(Left) Figure 3: All focus stacked fly images loaded into Photoshop Layers; (Right) Figure 4: Aligning and blending the focus stacked layers in CS6

Don’t try macro focus stacking by moving your tripod in and out; you’ll not only have little control over the focus points, you’ll also lose image registration that’s so important for the stacking software.

The first step is to get all 72 images into one layered Photoshop image. Figure 2 shows all 72 Photoshop layers selected in Bridge. Under the Tools menu, I chose Photoshop>Load Files into Photoshop Layers. After Photoshop performs its layering magic, the layers panel will look like the one in Figure 3.

Next is the actual focus stacking in two steps, as circled in Figure 4. First, I align the layers and then blend them.

focus stacking, dan burkholder, photo technique
Figure 5: Auto-Align Layers option dialog box (Hint: Leave it in its default auto mode)

Aligning the Layers in CS6
Aligning the layers is important because there will be disparities between the images both in terms of alignment and size. Think about it, as you focus, you move the lens closer or further away from the sensor and that changes the image size. In cases like this (shooting the fly) I used a Velbon Macro Focusing Rail that let the camera/lens assembly move with precision. For close-up work this is much better than trying to turn a focusing ring on the lens.

Executing the Auto-Align Layers command introduces the Auto-Align Layers dialog box in Figure 5. Notice that I’m leaving the default Auto option selected. Frankly, I don’t know how to use the other choices but Auto works amazingly well.

focus stacking, dan burkholder, photo technique
Figure 6: A single Aligned Layer in the Aligned Stack

Here’s a first taste of serious focus stacking magic. Figure 6 highlights a single layer after executing the Auto Align command. Look at the layer (highlighted with a green perimeter) to see the transformation that Photoshop imposed to account for image size differences and slight subject movement. Photoshop actually performed a trapezoidal shape-shift to the layers as it worked to make them all the same size and shape. Amazing! But wait till you see the next step.

Photoshop Blending
Once the layers are aligned, it’s time to blend them using the Edit>Auto Blend Layers command. See Figure 7 for the dialog box. Here I’m not building a panorama so Stack Images is the proper choice, along with the Seamless Tones and Colors option.

focus stacking, dan burkholder, photo technique
Figure 7: The Auto Blend Layers dialog box

In Figure 8 Auto Blend has been applied to the layers. I’ve highlighted one of the layer masks so you can see the magic that Photoshop performed. Remember, it creates a different mask for each of the 72 layers. The masks reveal a tiny slice of sharp detail in each image to build the extreme depth of field in this final focus stacked image.

Photoshop’s Blending Anomalies
Though CS6 appeared to do a fine job of blending the images, take a look at Figure 9 to see two problem areas. Photoshop did not do a good job of distinguishing detail between the tiny hairs and it also produced a blurry artifact on the fly’s back.

focus stacking, dan burkholder, photo technique

Figure 8: Photoshop's Auto-Blend Layers builds masks for every layer.

To the Rescue: Zerene Stacker
Photoshop can do a competent job of focus stacking in some situations, but not all. If you really get serious with your focus stacking, download the trial version of Zerene Stacker This software is highly focused (pun intended!) on combining your series of varied focus point images. Zerene Stacker’s interface keeps you apprised of what’s happening.

focus stacking, dan burkholder, photo technique

Figure 9: Photoshop fails to build some areas with sharp detail.

The left side of Figure 10 shows the loaded series of fly images; the right side shows both the individual image that is being processed along with the final stacked image on the right. With much more control than Photoshop (and much faster to boot) Zerene Stacker produced the fly image in Figure 11.

Notice the lack of unsharp areas in the Zerene Stacker version. When you start working with Zerene, you’ll discover many image tweaking options that help you with specific subject matter. Combined with many helpful tutorials and speedy tech support, this software will help you create amazing images.

There are other software options available for your stacking challenges. Helicon Focus, CombineZP, Tufuse Pro and Picolay are several popular alternatives. Check individual websites (see Resources) for Mac/ PC compatibility.

focus stacking, dan burkholder, photo technique

Figure 10: Zerene Stacked in action.

focus stacking, dan burkholder, photo technique

Figure 11: Fly Head stacked with Zerene Stacker

Depth of Field Calculators

For the geeks in the reading audience (be proud—I am!) there are some handy apps that will let you calculate DOF for any given sensor size, lens, and subject distance. Note: Of course these rules are out the window for tilt-shift or other photographically unorthodox optics.

DOF Master: This is a fine web-based DOF calculator. While on the web page, take note that Don Fleming also makes apps for Android, iOS and even Palm OS.

Field Tools: An App by Brad Sokol it’s free (iOS only at this time) that provides both camera and lens profiles. This makes it easy to calculate DOF for, say, your Nikon D800 and your Panasonic GF5.

Lens Lab: One of the neatest DOF calculating apps because of its clever visual DOF representation and camera/lens selection methods. Alas, it’s iOS only.

TrueDoF-Pro: This App offers advanced DOF calculations. It’s algorithm for calculating DOF includes the effects of diffraction.

No matter what method you use for calculating depth of field, eventually you will encounter a shooting situation in which you can’t have all regions sharp in a single capture. Or, you find that stopping down your favorite landscape lens to f/22 causes resolution to drop off owing to diffraction. It’s just these demanding conditions that call out for focus stacking! See Resources for more information.

Focus stacking isn’t for everyone, just as black and white photography isn’t for everyone. But used properly (or, heck, even improperly), it adds a whole new perspective to your image making. Photography in the 21st Century is much like an amusement park ride. You can be afraid and avoid the park altogether, you can stand at a distance and watch others having fun, or you can jump on board and enjoy the thrills. Focus stacking is a ride you should take at least once!

Resources: Websites: CombineZP:; DOF Master:; Field Tools by Brad Sokol: itunes; Helicon Focus:; Lens Lab: itunes; Olympus OM-D:; Picolay:; TruDoF-Pro:; Tufuse Pro: tufusepro.htm; Velbon Macro Focusing Rail; Zerene Stacker:; Nik Silver Efex Pro:

About the Author

Dan Burkholder
Dan Burkholder has been teaching digital imaging workshops for 15 years at venues including The School of the Art Institute, Chicago; The Royal Photographic Society, Madrid, Spain; The International Center of Photography, New York; Mesilla Digital Imaging Workshops, Mesilla, NM and many others. Dan’s latest book, The Color of Loss (University of Texas Press, 2008), documents the flooded interiors of post-Katrina New Orleans and is the first coffee table book done entirely using HDR methods. His award-winning book, Making Digital Negatives for Contact Printing, has become a standard resource in the fineart photography community. Dan’s iPhone images can be seen at: