Focus Stacking


In my previous blog post, I included a few images that used the focus stacking technique. This method blends a series of images to ensure all points of the scene are sharp and in focus. This tutorial will show you how to get started with focus stacking your landscape images.

Focus stacking is a useful technique for landscape photographers as well as in macro photography. I will be using landscape photos for my examples and discussion. When you are out in the field, you may decide you want to incorporate a distance background, like a mountain, and a foreground that is very close to the camera. If you focus on the foreground, your background will be blurry and vice versa. If this is not the look you want for your image, then you may want to consider focus stacking.

In some cases, it may be enough to adjust your camera settings. If you use a very small aperture like f22, you will have a large depth of field. So a larger portion of your image will be in focus, but due to the optics of your lens, the image will be softer because of diffraction. Stopping down will give you sharper images, but this may not satisfy your requirement for foreground and background sharpness. A range between f11 and f16 may work as long as your foreground is “far enough.” The “far enough” value is dependent on your focal length and called the hyperfocal distance – the focusing distance that gives you the greatest depth of field.

If you decide the hyperfocal distance does not give you the results you want, then it may be time to try out focus stacking. You will need at least two images to process. Everything about these images needs to be identical. Put your camera on your tripod, keep the same settings (shooting manual is good here) and use live view to zoom in on portions of the scene and manually focus on each portion.

The first two images show my camera set up with the frozen methane bubbles as the foreground. Final image shows a background included.

Focus Stacking in Photoshop – Fully Automatic

The first thing you will have to do is load your photos into Photoshop. I use Lightroom and so I just selected my photos and opened them as layers in Photoshop (click on the images to see larger versions). Make sure your images are in order Рforeground to background or background to foreground.

Three images loaded into photoshop. They are labelled foreground, mid and background to indicate where the focus point was.

If I turn off the foreground and mid layers (click on the eyeball next to the layer to turn it on and off), the leaf in the ice is blurry in the layer where I focused on the mountain in the background.

Background layer is the only layer visible.

Here is the zoom in on the leaf:

Zoom in on the leaf – foreground layer is visible.

Zoom in on the leaf – background layer is visible.

Make sure all your layers are visible again (eyeball should clicked on) and select all the layers. Then go to Edit -> Auto-Align Layers.

Auto align layers.

Click ok to the let program align the image automatically.

Automatic alignment.

Photoshop will align your layers. You may see some white space around the image now since each layer was warped slightly to fit with the others. All your layers should still be selected. Select Edit -> Auto Blend Layers.

Auto blend layers.

We want to stack our images, so in the next pop up window, select Stack Images.

Select Stack Images.

Photoshop will automatically blend the layers and create a new merged layer with the focus stacked image. Provided nothing went wrong and there were no errors…

Final stacked image created automatically by Photoshop.

Zoom in on sections of the image to ensure the blend was done correctly.

Zoom in on foreground.

Zoom in on mid ground.

Zoom in on background.

Focus Stacking in Photoshop – Manual Blending

If you have a more challenging image and Photoshop was not able to blend your layers correctly, or you are not satisfied with the results, it is possible to manually blend your images. For my example this will be easy to do.

We will begin from the step where the images were auto-aligned. Click on the foreground layer and add a layer mask. You can do this from the bottom of your layer panel by clicking on the rectangle with a circle inside.

The layers have been auto-aligned only.

In the layer panel there is a white box next to your foreground layer. This is your mask.

We will need to invert the layer. White means everything shows through and black means everything is masked. Click on the layer mask and type Cmd+I or Ctrl+I. Then select the paint brush tool.

The layer mask next to the foreground layer is now black.

With the brush tool you can paint in the section of the image that you would like to be visible. If you want to check what you have painted, hold down the alt key and click on the layer mask. The mask will now appear over your image. Hold alt and click on the layer again to remove the mask view.

The layer mask imposed over your image.

Click on the next layer down, add a layer mask and paint in the portion you want visible from that image.

The mid layer now has a layer mask.

Again make sure you zoom in and check your work. You can also turn the layers on and off to check if you have painted in a section that is not in focus or if you missed spots.

Finally, crop the image. After the auto-alignment there may be white space around the edges of the images or edge artifacts after the blend.

Crop tool is used.

Further Examples

Aurora and frozen methane bubbles by Calgary night photographer Monika Deviat

Methane bubbles and aurora. Focus stacking was needed here to ensure the foreground and stars were sharp.

A large boulder under starry skies with Orion shining brightly by Calgary Photographer Monika Deviat

This is a three shot vertical panorama shot with the Nikkor 50mm lens. Without focus stacking, the boulders would be sharp and the stars would be blurry (bokeh) or vise versa.

Subscribe to my newsletter to keep up to date on tutorial, workshops and other exciting news!