Create the perfect macro image using focus stacking in Photoshop


A big passion of mine is photography and I love using new tools and learning new techniques to gain a better image. Over the last few weeks I have been experimenting with focus stacking and want to share with you what I have found.

Focus stacking (also known as focal plane merging, z-stacking or focus blending) allows you to take multiple images (each focused slightly differently) and then merge them, taking focused bits of each image and making a fully focused one. The concept is simple. The method is pretty straight forward as well, once you know what you are doing! I am sure there are plenty other ways and other software and hardware out there. I am just going to take you through the method that I have used.

Minimum equipment needed…

  • A camera that allows you to manually focus
  • A tripod
  • Photoshop (other software can be used but for this tutorial I use Adobe Photoshop)
  • A computer that will run Photoshop
  • Something to photograph

My equipment

  • Pentax K-5 DSLR
  • Sigma 70-300mm f4-5.6 Macro DG Lens For Pentax Digital & Film SLR Cameras
  • Pentax AF-360FGZ flash
  • x2 Soft box continuous lighting
  • A tripod for the camera
  • A tripod for the flash
  • Mac Book Pro with Adobe Creative Cloud
  • Adobe Photoshop CC 2015
  • Back drop of white or black paper

I have broken this down into 5 steps…

  1. Set up the shots
    You need to know what you want to photograph and how to compose the subject. This is a lot more than I can cover in this article but good thought before starting results in a good end product. This process requires a bit of planning. You want the lighting to be constant for every shot, you want the background to remain constant. For step 2 you may be moving the camera. A camera mounted flash would move with the camera so would affect the lighting. A separate flash or continuous lighting solution would be better.
  2. Take the shots
    I started this knowing the general theory – take an object, focus on the most distant part of it, take a photo. Change the focus so that it is a bit closer, take a photo. Repeat until you have a range of photos, partially in focus for each one but collectively covering all of the object. I started doing this with the focus ring on my lens. The result was not perfect, there was no way to increment in a uniform manner and I could not get as fine tuning as I wanted.I bought a focus rail (for under £20)
    You attach this to the tripod and then screw the camera in on top. The bottom dial allows you to roll your camera backwards and forwards. This moves the focus through the object. In the same way as the focus ring, you take photographs along the entire length of the object. For the pen I took 34 photos, moving the camera 100mm (4 inches) in total.Below are five of them to show how the photographs range. I used all 34 in steps 3 to 6.
    pen-1 pen-2 pen-3 pen-4 pen-5
    You can see that the focus shifts and also that the pen moves from photo to photo. As long as the subject is in shot this doesn’t matter, Photoshop will sort that out for you!
  3. Import as layers and align
    Now you have the shots, you want all of them in one Photoshop file, each as a different layer. There are a few ways to do this but the best way I have found is this…
    In Photoshop: File>Scripts>Load Files into Stack
    This will let you select all of the files that you want to load. There is an option here to ‘Attempt to Automatically Align Source Images’ – If you tick this then the files will all line up (which is what you want!)
  4. Blend layers
    You have all the images on different layers, all lined up. You can check at this point to see if it has worked correctly. I have found that now is a good time to crop your image. The blend process takes a bit of time as Photoshop is calculating what is in focus and what isn’t. On my images you will see that there is a bit of table where the backdrop did not extend. Photoshop will try to blend this if you don’t crop and it will take longer. When you are ready, in Photoshop go to Edit > Auto-Blend Layers… Select ‘Stack Images’ and check “Seamless Tones and Colors’ and ‘Content Aware Fill Transparent Areas’. It will take a few minutes but when completed you will have your sharp image.
  5. Tidy image
    I didn’t have to do much to this image but for some you may have to retouch a little. All of the layers have been modified in a non-destructive manner using layer masks. You may see that part of the image looks better on one of the individual frames. You can copy that layer, bring to the front, mask out what you don’t want and then use that part over the blended image.

Here is the resulting image…


And a zoom of one part of the completely focused image…


And here are some of the other the results…


Paul Smith cufflinks – these didn’t come out as well as I had hoped – more work needed here!


A glass sculpture I bought in Venice by Vittorio Costantini, 90mm (3.5 inches) long

You can see more of Vittorio’s work here…


A specimen of a Willowherb hawkmoth (Proserpinus proserpina) – A little bit of retouching required here to remove the mounting pin. Moth wingspan 45mm (1.8 inches)

Even something that has a very shallow depth, like this leaf, can benefit from this technique

Even something that has a very shallow depth, like this leaf, can benefit from this technique

I hope that you have benefitted from this article. Good luck with your shots!


Leave a Reply

Your email address will not be published. Required fields are marked *