Facebook Pixel How to Focus-Stack Macro Images using Photoshop

How to Focus-Stack Macro Images using Photoshop


One of the biggest challenges facing macro photographers is getting your subject in focus. Not only is hitting the perfect focus point an exercise in frustration, but often you don’t have enough in focus. Unlike a landscape photographer who can set their aperture to F/22 and be happy, a macro shooter will likely be rewarded by blurry images – and even if they are sharp, the focus still won’t magically spread from edge-to-edge. The best solution is to use a technique called “focus stacking”, which combines multiple frames together to increase the area of the image that is in focus.

Focus stacking requires you to photograph your subject at every single possible focus point you’d like to have sharp, and then combining those images together to get one image where everything has detail. There are tools to achieve this – dedicated tripod accessories called “focus rails” and dedicated software for combining images (Helicon Focus and Serene Stacker are two I’ve used before). For this article, let’s keep things simple with what you already have: no tripod required, and we’ll be using Lightroom and Photoshop.

pollen inside a flower. Each grain of pollen is 70 microns long and the image is created using 16 separate frames for increased focus

pollen inside a flower. Each grain of pollen is 70 microns long and the image is created using 16 separate frames for increased focus


There are a few tips to get started with hand-held shots intended to be focus-stacked. Firstly, you’ll want to set your camera lens to manual focus and leave the focus ring set to the closest focusing point. On a dedicate macro lens, this would generally mean 1:1 lifesize magnification. From this point forward, you won’t be changing your focus by the lens, but rather moving the entire camera forward or backward to get your subject in focus.

You’ll also want the camera on continuous shooting. We’ll be firing off as many shots of the subject as possible as quickly as we can.

Using flash is a good idea, as this allows you to keep a faster shutter speed and help ensure that all of the resulting images are free of motion blur (from either the camera or the subject).

When you’ve found your subject, the most critical element of shooting is that you only move the camera forward and backward. Any major side-to-side, up-and-down shifting will create a change in perspective which makes focus-stacking much more difficult. This takes practice, but I find if you hold the end of the lens securely and find something to brace yourself with, the results are better.

water droplets refracting the image of a flower on a spider web. 20 separate frames were used to bring the entire image into focus

water droplets refracting the image of a flower on a spider web. 20 separate frames were used to bring the entire image into focus

If holding an off-camera flash, holding the end of the lens and the camera seems daunting – it is. Doing it all yourself isn’t impossible, but you’ll find it easier with an assistant holding the flash or using a ring flash to simplify the equation.

Fire away, and take far more images than you think you need. Move the camera forward and backward through the focus area and drastically overshoot. When putting a macro image of a snowflake together I may use 40 frames, but I’ll shoot 200. This is necessary because you’re shooting in uncontrolled intervals of distance and may miss a spot.

Starting in Lightroom:

Once you have your images imported into Lightroom, you’ll need to start selecting an image from each focus point. Clear your world from distractions, because you’ll need to make a mental note of which areas of focus have already been selected and which ones you still need to find as you look through your images. I flag the images I need with a “pick” flag (P key) and move on searching for the next missing frame.


When I think I’ve found all of my focus points, I’ll typically choose a central frame and apply any global adjustments I’d like to make to the RAW data. Exposure adjustments, noise reduction, white-balance correction, etc. When I’m happy with the general look, I right-click on the image and select “Develop Settings > Copy Settings”. Make sure the changes you made are checked, and copy.

You’ll now need to filter your images to just see the “picks”. This is done by choosing “flagged” from the filter dropdown box in the lower right above the filmstrip. Now you can select all of your flagged images, right-click on one of the thumbnails and choose “Develop Settings > Paste Settings”. This will apply the adjustments you made to every frame.


Still having all of your images selected, right-click on one of the thumbnails again and choose “Edit In > Open as Layers in Photoshop…” and then Photoshop will take over the next part of the process.

Moving into Photoshop:

Once all of the layers have been loaded, select all of them in the layers palette and then from the top menu, choose “Edit > Auto-Align Layers…”. This will take all of your images and adjust for the slight horizontal, vertical and rotational shifts that occurred when shooting the images. Photoshop does a pretty good job and re-aligning your images as long as you didn’t move too far out of perspective.


At this point, we’re going to assume that you’ve missed at least one section of focus from your image, and we need to find what your missing puzzle pieces are. From the same menu with all of the layers still selected, choose “Edit > Auto-Blend Layers…”. On the dialog box that is displayed, be sure that “Stack Images” and “seamless tons and colours” are selected. Click okay, and the stacking algorithm goes to work combining the images. Your jaw might drop at this point when you see the combined image. However, zoom in and look closely and you’ll likely see something similar to this:


One section of the snowflake is clearly out of focus, as if one “sliver” of focus was missed when I initially selected by frames. At this point, I go back to Lightroom and find my missing frames, paste the adjustment settings on them, and flag them as a “pick”. Select all of the images again, including your missing pieces and choose “Edit In > Open as Layers in Photoshop…” once again. Now we’ve got all of our pieces to work with!

compare with the above image – this one is exactly the missing piece of the puzzle

compare with the above image – this one is exactly the missing piece of the puzzle

Back to Photoshop, follow the same process as before by selecting all the layers and choosing “Edit > Auto-Align Layers…”. After that’s done, we’re adding a step before blending. Photoshop’s auto-blend tool works well, but makes all kinds of mistakes. We’ll need to fix these manually, so after aligning but before blending, you need to right-click on your layer stack and select “Duplicate Layers” (CTRL+J is the keyboard shortcut).

Now with one “set” of layers selected (this should be selected by default), choose “Edit > Auto-Blend Layers…” and make sure the dialog box is set as before. If your computer has limited RAM and CPU power, this may take an extremely long time if you have many frames open. For the image I’m working on, I ended up using 46 frames, which means Photoshop now has a total of 92 layers open, each containing an 18MP image, and we’re asking it take half of them and compute some very heavy math. If you haven’t had lunch yet, go make a sandwich. Here’s what we get when the process is complete:

image also cropped square

image also cropped square

Refining the results:

Your image is getting closer, but if you zoom in you’ll find all sorts of “defects”. See if you can spot them here:


Backgrounds come in strangely at times, sharp edges at different depths become blurry and slight alignment issues pop up. We’ll need to fix this by masking in the proper pixels from the original set.

First step: merge your current blended stack together (CTRL + E keyboard shortcut). You’ll now take this stacked layer and drag its position down to the bottom of the layer order, underneath all of the un-stacked images. You’ll then have to turn off the visibility of all the un-stacked layers, by click on the eye icon to the left of the layer thumbnail.

Now the fun begins. Create a layer mask on the layer directly above the “finished” layer, and get friendly with the invert keyboard shortcut (CTRL+ I). You’ll bounce back and forth with the invert command on the layer mask and look at the area where that particular layer has focus. You’ll switch back and forth until you notice an area that looks better on the original layer vs. the “finished” layer and, using your brush tool, mask in the appropriate pixels to fix the mistake.

Do this for all layers and expect it to take some time. Let’s compare the above mistakes to the refined results:


Look closely and you’ll see many “fixes” applied to just this small section of the image. The process can take hours depending on the number of layers, the number of mistakes, and how much of a perfectionist you are.

In the case of a snowflake photographed on a black mitten, I want to remove as many fibers as possible from the finished result. This is accomplished largely in the above-described fixes, by selecting the layer which has the most-forward focus and masking its background into the completed image:


At this point, you’re back to standard Photoshop work. Use your clone tools to clean up anything you didn’t already fix, and adjust the image to your liking. With most macro subjects, you can also choose to rotate or flip your image around for the best composition. An insect looks perfectly natural up-side down and backwards – if it aids in your composition, don’t be afraid to play!

For the average snowflake image, it’s a 3-4 hour process from beginning to end, combining typically between 30-50 frames. Depending on your subject and the level of magnification you’re working with, you may only need 6 frames. The process however, remains the same:


The Snowflake Book

If the tutorial above interests you, it will be spelled out in greater detail in my upcoming book, “Sky Crystals: Unraveling the Mysteries of Snowflakes”. The book is currently available for pre-order, to be released in October 2013. Help support the book project!


The book will be 300 pages, hardcover and detail all of the photographic techniques, science & physics, and even the psychology and philosophy of why we find snowflakes beautiful.

Check out more of Dons work at http://www.donkom.ca/

Table of contents

Macro Photography

Read more from our Post Production category

Don Komarechka
Don Komarechka

is a Canadian nature & landscape photographer. His work revolves around unique perspectives and unseen subjects. Don has recently published a book on snowflakes and macro photography and his work can be seen on his website or on Google+.

I need help with...

Some Older Comments