Unlimited AE and Premiere Pro templates, videos & more! Unlimited asset downloads! From $16.50/m
  1. Photo & Video
  2. Macro

Focus Stacking for Extended Depth of Field

This post is part of a series called Macro Photography.
Abstract and Colourful Close-Ups
Make, Find, and Improvise: Creative Backgrounds For Still Life and Macro Photographs
This post is part of a series called The Art of Compositing and Digital Image Manipulation.
Creating a Realistic Composite Photo with Displacement Mapping
Final product image
What You'll Be Creating

One of the things we can struggle with in close-up photography is a narrow depth of field. This is usually caused by shooting at a wide aperture coupled with being fairly close to your subject. There are ways around this without losing your pleasant blurred background or important detail: one of these methods is focus stacking.

Focus stacking is taking more than one photo of the same subject with a different part of the object in focus and combining them to make one photo. In this tutorial I’ll be using Photoshop CS6 to merge the results and take you through the steps that we’ll be taking to achieve our focus stack.


Generally when shooting with the intention of focus stacking, it’s advised you use a tripod, as you want the two (or more) images to overlap properly or your stack won’t work. However, if you have a relatively steady hand then don’t worry about this too much, I’ve done all of my focus stacking (including this example) hand-held and it works fine; Photoshop is quite forgiving if you allow a little room to crop the uneven edges of your photos later. 

This is our focus stacking example. I'm using two pictures to keep things simple but you can use as many as you like. 

Two example pictures
Our two pictures to be used in the focus stacking process [Photo: Marie Gardiner]

As you can see, the picture on the right has a blurred flower but also elements of the spider web that are in focus that I’d like to keep.

Open your pictures into Photoshop (you can still make your RAW adjustments if needed, just be sure to synchronise the pictures first so the same changes are applied to both). Once opened, go to File > Automate > Photomerge.

Screen-capture of photomerge in Photoshop
Photomerge in Photoshop CS6

Click ‘add open files’ and make sure ‘blend images together’ is not ticked as you want the photos to be layered on top of one another:

Screen-capture of photomerge options in Photoshop CS6
Photomerge options in Photoshop CS6

Press okay to create your layered images and you’ll see Photoshop has aligned them, probably leaving some transparent or harsh, obvious edges… don’t worry about these just yet.

Erasing blurred aspects of your image 

Screen capture of layers
Our two example pictures are now layered one on top of the other

You can see my two pictures in the layers panel on the right hand side and the blurred flower is on top. Have the image you want to erase blur from on top (sharp focus on the bottom layer), choose the eraser tool, change it to a soft, large brush and gently start to erase where the blurred parts are that you want sharper. It may help if you either lower the opacity of the bottom layer, or make it entirely invisible so that you can better see what you’re doing:

Screen capture of erased layer
Our top, blurred layer is now erased in parts

It’s worth noting here that if you know how, you should do this through a layer mask instead of erasing, but to keep this tutorial straightforward I'm using the eraser in this instance.

Continue to erase any parts that aren't in focus but were in your other shot(s). If you’re doing this for more than two pictures, remember to work on more than one layer; you’ll need to go through each one as demonstrated, erasing the out of focus parts that you want to be sharp. If you find that there’s been a slightly different exposure for each shot and you can see the erasing line once you return the opacity to 100%, take a soft (smaller) eraser brush and lower the opacity to 30-40% and go around the visible edges. Work outwards and keep lowering the brush opacity until you can’t see the edge (the clone-stamp tool may also be of use here).

Merging the layers and cropping your picture

Once you’re happy with your result, you can merge the pictures together by going to Layer > Flatten Image:

Screen capture of flattening an image in Photoshop
Flatten your image in Layer > Flatten

When you have your flattened image, use the rectangular marquee tool to select where you want the edges of your picture to be, so not including any rough/transparent edges and then click Image > Crop.

Cropping your picture will remove any obvious overlap from your pictures

Now make any final adjustments you feel the image may require and you’re done

Finished focus stacked image
My finished focus-stacked image with adjustments

In my example, I cooled off the colours a little, brought back a few blown out highlights and gave the background bokeh a soft pop.


Focus stacking is very effective but is it worth the time and effort?


  • It is very useful for overcoming the shallow depth of field problems that close up photographs can be limited by.
  • You can be creative with things that you couldn’t necessarily have got at the time; selective focus for example.
  • If you find after shooting that your focus was slightly out on a picture, it’s recoverable if you have a similar shot.
  • You can use the technique to get incredible detail from a close, wide aperture shot.


  • It is incredibly difficult to focus-stack anything with movement (without specialist equipment like a focusing rail), so you’ll find yourself greatly limited if you try to do this with insects or a flower blowing in the wind etc.
  • It requires a steady hand or a tripod
  • You need specialist software to merge your photos

If you have the appropriate software, I certainly think focus stacking is worth a go. It’s a good skill to learn and in the right circumstances can be incredibly effective; just don’t rely on it for the perfect shot.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.