Skip to main content

How to use focus stacking to get impossibly sharp photos

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.

Some Panasonic cameras, including the Lumix GH5, can even do focus stacking in camera using the same 4K Photo mode that allows photographers to adjust focus after the shot.

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.

Image used with permission by copyright holder

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.

Image used with permission by copyright holder

6. Merge.

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.

Editors' Recommendations

Hillary K. Grigonis
Hillary never planned on becoming a photographer—and then she was handed a camera at her first writing job and she's been…
How to take great photos with your Pixel 4 or 4 XL
pixel 4 xl camera close up

Google sure knows how to make a great camera. The Pixel 4 and Pixel 4 XL boast the same amazing dual-lens camera, backed by Google's image processing wizardry. It compares very favorably with the top camera phones available when it was released in the Fall of 2019, with stellar images that left our photographers eager to plumb its depths and learn its ins and outs. In the months since it was released, other phones have pushed phtoography further, of course: Triple-lens cameras are becoming common, such as those found on the LG V50 and new LG V60, and the hot new Huawei P40 Pro comes with a 5× optical zoom that leaves the Pixel 4's telephoto in the dust.

Still, Google's Pixel 4 camera is capable of capturing wonderful pictures, preserving your precious memories, and even shooting the stars in the night sky -- and we're about to explain exactly how to do all of those things. This is our Pixel 4 camera guide.
What's new
Thanks to the power of software, Google is able to continually update its hardware, and the camera in the Pixel 4 and Pixel 4 XL is no exception. With the first update, from November of 2019, Google revealed "camera quality improvements" -- though what exactly those were was unclear. In March 2020, as part of the second "Pixel feature drop," Google announced two camera fixes, one preventing a crash when the Camera app switched to video, the other improving auto white balance in certain lighting scenarios. There wer similar improvements to Autofocus as well. Good stuff!
Camera specs
Before we dig into the details, it's worth noting that the main and front-facing cameras in the Pixel 4 and Pixel 4 XL are identical. There's no difference in the quality or the features, so whichever Pixel 4 you opt for, you'll get the same awesome camera.

Read more
How to add and edit text in Adobe Photoshop
how to add text in photoshop

Photoshop is as much a graphic design program as it is a photo editor, which includes working with text. Adding and editing text in Photoshop is simple, once you learn where all the controls are and a few extra tricks. Here’s how to add and edit text in Photoshop.
Photoshop's text tools

A majority of working with text in Photoshop is simply finding and recognizing the icons. Here are the tools that you may use to add or edit text in Photoshop.

Read more
Photoshop for iPad finally has Edge Detection — here’s how to use it
how to use photoshop for ipad refine edge selection hair cropped

Photoshop for iPad has a long way to go before it has all the bells and whistles of its desktop counterpart, but a new addition could give the tablet app a serious advantage. On Monday, July 27, Adobe began rolling out the Refine Edge tool on the Photoshop iPad app.

From the start, Photoshop for iPad has focused on elements that the touchscreen makes easier. The Refine Edge tool wasn’t among those original options, though the company previously shared that the tool was in the works. Adobe says the engineering and design teams needed to ensure the tool was familiar to use while maximizing the pencil’s interaction with pixels. Speed was also a focus on developing the tool.

Read more