Focus Stacking

Depth of Field

Before we get into the main element of this blog, focus stacking, we need to go over the basics.

Every lens has an aperture which controls not only how much light is allowed to pass through the glass, but also how much depth of field there will be.

Credit to:

The wider the aperture (ie: f/1.2, f/1.4, f/1.8) the more light passes through the lens and the smaller the depth of field.

The smaller the aperture (ie: f/8, f/9/, f/11, f/13) the less light passes through the lens and the resulting depth of field is increased.

Portraiture photography looks best when the aperture is larger, creating really dramatic out of focus areas (known as bokeh). For landscape photography, you usually want the largest depth of field your lens can provide.

When you set your aperture too small (f/18, f/22+) the lens begins to diffract, resulting in less than ideal image quality. Most lenses have a sweet spot at around f/8-f/11. This will allow you to get the sharpest image your lens can produce. Using f/8-f/11 however is not ideal because the DOF (depth of field) isn’t the lenses largest it can be.

Now we can understand where focus stacking will come into play. Essentially all it is, is taking multiple frames, focused at different areas of your scene and then combining them to get an entire photo in sharp focus. Layering the shots must be done in Photoshop.

Distance to Subject

How far away your subject is determines how many shots you will need when focus stacking. This technique can have dramatic effects when you “fill the frame” with your subject, sometimes being only inches from it. Getting so close to your subject will consequently produce an even shallower DOF. Thus you will need to capture more frames to blend into focus.

If you are a few feet away from your foreground, you might only need two frames to get the entire scene in focus using f/8-f/11.

Align the Layers

When you focus on different areas of your composition, you will notice the lens changes the overall composition slightly. This is called “lens breathing” or “focus breathing”. When you go to stack the images in photoshop, you must align them before blending them, or else the frames will overlap unaligned and look completely off.

Sync Develop Settings

When you are focus stacking images together, you want them to all be edited similarly, or else you will get anomalies in your final image. Make the initial edits to a single photo, and then you can sync those edits to the others in the series. This way everything will be consistent and produce a cohesive final photo. In order for the settings to be synced properly, you must have the edited photo selected. Hold the "CMD" key (Mac users) and then select the remaining photos. Once they are all highlighted, you may release the CMD key and "right click" to expand your options. You'll see these menus below and these options to sync the develop settings to the remaining photos. 

It's important to apply the cameras "lens corrections" settings before stacking and flattening the image together. Once your image is completed, Lightroom will not know which lens was used and cannot apply the correction settings. You may enter them manually, however it is easier this way for me. These settings will reduce lens distortion and make the photos appear, well, less distorted. It will also reduce vignette, which you are able to fine tune the effect. 

(see screenshot below on how to sync settings)

Select Photos and "Sync Develop Settings"

Select Photos, Right-Click, "Edit In">"Open as Layers in PS"

If you get this error click "Open Anyway"

Layers Stacked in Photoshop "Layers Panel"

Select All of the Layers

Click "Edit" > "Auto Align Layers"

Leave settings on Auto, click "ok" or press "enter key"

Now we can have PS blend the photos. Click "Edit" > "Auto Blend Layers"

Make sure "Stack Images" and "Seamless Tones and Colors" is selected and click "OK" or hit enter key

Once your computer finishes blending the images together, you will be left with all of your layers and each of them will have a layer mask attached to it. These masks were generated in the blending process. Zoom into your photo to 100%, check sharpness and see if PS missed any details or made any mistakes. If it was not done properly, you may have to "step backwards" until the auto blend is undone and then proceed manually. 

If everything is sharp as intended and nothing looks off, you can then go to "Layer" > "Flatten Image" and this will merge all the layers together, creating a much smaller file to work with. 

Once your image is flattened, you can now start fine-tuning things such as color correction, any healing or clone work that needs to be applied, saturation, etc. Remember to save once you are finished making your edits. Clicking "File" > "Save" or "CMD+S" (Mac Users) will ensure the photo is saved directly into Lightroom, where we have all of those individual photos that made up our layers for Focus Stacking. By clicking "File" > "Save As" you will break the chain between Photoshop and Lightroom and then have to save it elsewhere and then go into LR and reimport that saved photo. This is extra hassle, but another way to achieve the same goal if things somehow get broken between the two programs. 

A Few More Things Worth Mentioning

Shutter Speed

Since f/8-f/11 is your lenses sharpest, you will most likely be within this range. Instead of adjusting the aperture to the light, focus on adjusting your shutter speed and ISO. If you need to, use filters to balance the light and create the scene you envision.

Moving Subjects


Shooting flowers as a foreground in landscapes gets me very excited. They are also a pain to capture because if there is any breeze, it can be a nightmare to focus stack properly. Waiting for the wind to stop between shots can help, but if you want to get sharp flowers, you may have to manually blend the pictures together. If your foreground is a rock and its not moving at all, focus stacking is fast and efficient in Photoshop.

Manual Blending

Load the layers into stack in PS (photoshop). Add layer masks to each photo. Select every photo, click “Edit”>”Auto Align Layers”. Turn every photo invisible. Start from the bottom up and make only two visible at a time. Use the paintbrush tool to manually paint black over the layer mask, revealing the photo beneath it. This technique is tedious and time consuming but another method for achieving focus stacking when the “Auto Blend Layers” fails.

Adding Layer Masks

Make Working Photos Visible, Others "Invisible"

Select Paintbrush Tool, Use Black to "reveal" previous layer, white to hide previous layer

Foreground reveal example