Guide To Focus Stacking

Today’s cameras are impressive in how accurately they can autofocus: Look how deftly my camera locked focus on the subject’s face in a moving car as I panned and while the primary subject zoomed through the frame. But even today’s cameras can have trouble focusing in some situations, and that’s where focus stacking can help.

The companies that manufacture digital cameras continue to upgrade the technology that goes into them, including the sophisticated autofocus features. It’s part of the reason why photographers have such a variety of cameras and lenses to choose from that are capable of producing exceptionally vivid and sharp photos. Whether you photograph baby portraits, vast mountain ranges or music festivals, you can find a camera, and a plethora of focusing features and modes, that has been built to accommodate your needs.  

So Close And Yet So Far

In fact, you can bet that you’re going to see cameras get a lot smarter, as advancements in computer vision and artificial intelligence (AI) continue to mature, which will also affect how these devices focus on subjects. For example, Sony recently announced a significant firmware update to its a9 full-frame mirrorless camera body that will leverage AI to improve its already-impressive auto-focusing system by using machine learning along with several other algorithms.

So, could that mean that the dread of missing a moment of critical focus—say, the bride kissing the groom at a wedding or a child hitting a baseball with a bat at a little league baseball game—will soon be a thing of the past? Unfortunately, we’re not quite there yet, in part due to the limitations of physics. However, there are techniques and workarounds, which allow you to overcome this shortcoming on today’s cameras. A popular one is focus stacking.

Had I used focus stacking here, I would have been able to achieve a greater plane of focus, resulting in the hairs on the top of this insect being in focus.
Had I used focus stacking here, I would have been able to achieve a greater plane of focus, resulting in the hairs on the top of this insect being in focus.

Why ƒ/22 Isn’t The Answer

But before I delve into focus stacking, let’s take a closer look at a common focus problem and why one solution, using a minimum aperture, really isn’t the answer to your problem.

Have you ever taken a photo that you were truly excited to share only to toss it into the dustbin because you had just missed critical focus? Sadly, I know that feeling all too well: I’ll take a photo and get excited when I review it on my camera’s rear LCD screen. I even zoom in to check the focus.

Yet when I get home and check the photo on my larger computer display, I see why the photo will never see the light of day—because I missed focus. But it’s actually more than that. In these situations, it’s not so much that my photo is blurry because of camera shake or because the subject moved. The issue is that my plane of focus was too narrow and has resulted in me missing the critical focus of my subject.

So, why not set the lens to its minimum aperture, which is what conventional wisdom would lead you to believe? On many lenses, that would be f/22 (but you’ll want to verify that against your lens as it can vary). After all, if shooting a photo with a lens aperture of f/1.4 results in an extremely shallow depth of field, logic would dictate that moving to the opposite end of the spectrum would result in a greater depth of field. And that logic would serve you correctly to a degree.

Because of the shallow depth of field in this still life, the top edge of the tomato slice in the foreground is out of focus, which results in an unexceptional photo. Focus stacking could have been helpful in this scenario.
Because of the shallow depth of field in this still life, the top edge of the tomato slice in the foreground is out of focus, which results in an unexceptional photo. Focus stacking could have been helpful in this scenario.

But with optics being what they are, shooting with such a small aperture may not be the best course of action because of lens diffraction, a property of light wave interference that is introduced while passing through a very small aperture. The result of this interference is a softening of focus. It’s why you generally don’t want to shoot photos using the minimum aperture of a lens when your intention is to cover a great plane of focus.

Bringing It In Focus…With Focus Stacking

When you’re in a situation where the plane of focus within your composition can make or break the photo, you have two general options.

 The first option is to calculate the hyperfocal distance of the scene. What does that mean? Without going too far down a rabbit hole, since it’s a complicated topic, the hyperfocal distance is the point at which you can maximize the depth of field from the foreground to the background. This is important when you want to have objects in your foreground in focus as well as in the distance.  

In this example, I took one photo of this wintry landscape with my point of focus towards the bottom of the frame (left). I then changed my focal point to the mountain range in the background (right). Notice how in each photo, only the foreground or background is in sharp focus. (See details of outlines in red.) With focus stacking, my final photo (top) is sharp from the closest parts of the frame (lower portion) through to the mountain range in the distance (upper portion).
In this example, I took one photo of this wintry landscape with my point of focus towards the bottom
of the frame (left). I then changed my focal point to the mountain range in the background (right).
Notice how in each photo, only the foreground or background is in sharp focus. (See details of outlines
in red.) With focus stacking, my final photo (top) is sharp from the closest parts of the frame (lower
portion) through to the mountain range in the distance (upper portion).

But there’s a second option for getting a greater depth of field that we’ll focus on here: That’s focus stacking. And the reason I like focus stacking is that it offers me greater control over defining the plane of focus, and the process of creating a focus-stacked image has significantly improved over the years. With that said, it is not a foolproof process. It requires practice and, more often than not, manual intervention in the form of masking and blending.

Getting A Focus Stack

There are several ways to approach focus stacking, but in all cases, the method is generally the same: Your objective with your camera is to capture enough frames of varying focus points to produce a composite image (made from blending those frames) so that the resulting photo is sharp. The more you practice focus stacking, the better you’ll become in determining the optimal apertures for your lenses (which is sometimes referred to as its “sweet spot”), at which increment you should change focus, and how many brackets you should take.

Some camera manufacturers, like Fujifilm, even have a focus-stacking function built into the camera, allowing you to dial in the closest and farthest points of focus, as well how many bracketed photos you want. Once you execute the action, the camera takes care of automatically changing focus and exposing each photo.

In my experience, subject matter plays the greatest role in determining these factors. For example, if I am photographing a landscape scene and I want to ensure that both my foreground and background are totally sharp, I usually set my lens aperture between f/8-f/11 (depending on the lens) and take two photos. One photo will focus on the foreground and the second will focus on the background. With focus stacking, I’m left with a photo that is sharp from front to back.

With a focus-stacking feature built into some Fujifilm cameras, a lot of the effort is automated and makes the process much easier. Image Credit: Nicole S. Young
With a focus-stacking feature built into some Fujifilm cameras, a lot of the effort is automated and makes the process much easier. Image Credit: Nicole S. Young

However, it is with macro photography where focus stacking presents some truly magical opportunities by allowing you to control the plane of focus. It is with this control that you can avoid making the same mistake I’ve made countless times by miscalculating the plane of focus. In fact, it is that much more critical to have your depth of field dialed in with macro photos because of the magnification involved. By controlling which areas of your macro photo are sharp, you also control where your viewer’s eyes will snap to first. It is not nearly as forgiving as landscape photography can be at wider focal lengths.

Step-By-Step: Stacking It All Together

The ability to digitally “blend” a group of images through the process of focus stacking has come a long way, and while there are a number of ways to accomplish this task, I’ve settled on a straightforward, two-step process using Adobe Photoshop CC, which I’ll outline for you’re here:

Step 1: First, I export all of the bracketed photos into a folder on my desktop. While I can often get away with two or three bracketed landscape photos to focus stack, macro photos often require many more. In this example, there are 30 bracketed photos, with each one having a slightly different focal point within the frame.

Step 2: I launch Adobe Photoshop and navigate to File / Scripts / “Load Files into Stack…”

Step 3: Next, click Browse and select the folder containing the exported bracketed photos. Make sure you check the box for “Attempt to Automatically Align Source Images” and click OK. This process can take some time depending on the resolution of your source images as well as the power of your computer.

Step 4: Once the process is complete, you will see that each of the source images has been added on its own layer in the Layers Panel. Select all of the layers, and then click on Edit \ “Auto-Blend Layers…” On the following screen, select the option for “Stack Images” and ensure that both checkboxes for “Seamless Tones and Colors” and “Content Aware Fill Transparent Areas” are checked. Then click OK.

Step 5: When the blend is complete, you should be left with a photo that has sharpness across the entire plane of focus determined during exposure. In other words, you should have detail from the closest point of focus to the farthest. With that said, you may need to refine the masks that Photoshop automatically created in case touch-ups are required needed.

Image Credit: Nicole S. Young
Image Credit: Nicole S. Young

Step 6: With continued experimentation, focus stacking can give you greater control of your photo’s plane of focus while ensuring that everything you intend to be sharp actually is. 

Leave a Comment

Menu