Macro Photography Focus Stacking 101

Depth of Field on Steroids for your Macro Shots

When you are doing macro pho­tog­ra­phy, the ben­e­fit is you can find heaps of sub­jects in your gar­den (if you have one) or around where you live. No need to pay for a trip to Ice­land or Paris or New York. Great macro oppor­tu­ni­ties are everywhere.

My guess is that you already know that if you read an arti­cle about focus stack­ing, so I won’t dig into what macro pho­tog­ra­phy is and what you need. I assume you have a good macro lens or close­up fil­ter or any­thing to get you close to your subjects.

One annoy­ing side effect of macro pho­tog­ra­phy is the very (very!) shal­low depth of field. I am talk­ing about mil­lime­ters or even less. Most sub­jects will not fit into an accept­able depth of field to be sharp in all the right places. If you are in a cam­era club and entered macro images into a com­pe­ti­tion, and the judge said some­thing like “Nice sub­ject, but the [insert body part of your lit­tle crit­ter here] is not in focus, try some focus stack­ing next time!”, then I can help you with that.

Let’s get into it. I’ll tell you some­thing about:

  • What is Focus Stacking?
  • Why do you want to use it?
  • When is an excel­lent oppor­tu­ni­ty to do it?
  • How do you do it?
  • What are the com­mon pitfalls?
  • Soft­ware alternatives
Global Photo Club

What is Focus Stacking?

Focus stack­ing is basi­cal­ly merging/blending sev­er­al images with dif­fer­ent focal points. In post-pro­cess­ing, you use soft­ware to more or less automag­i­cal­ly merge the in-focus parts into one image which then appears to have a greater depth of field than the orig­i­nal sin­gle images. It’s a bit dif­fi­cult to put it into words, I’ll bet­ter show you what I mean.

This is what you might get in sharp focus when you want an accept­able shut­ter speed:

This is an image of a very coöper­a­tive moth sit­ting on our house wall. Wasn’t mov­ing much, so I could go back to get my cam­era, set up my tri­pod and shoot a series of images intend­ing to post-process them with focus stacking.

This is just one exam­ple image of the series. You can see that not every­thing is in accept­able focus, only a small slice is sharp (enough), the stuff inside the green marked area. That’s not good enough. But I am already at f/8 and 0.4 sec­onds. So to get a greater depth of field, I have to decrease the aper­ture (make the hole small­er, big­ger f/number). But I found that going to f/22 would increase the shut­ter speed to sev­er­al sec­onds, and even with my patient sub­ject, it was still mov­ing a lit­tle bit and the result was not very sharp. You also get a prob­lem with decreased image sharp­ness caused by dif­frac­tion, so just using a small­er aper­ture is not always the solution.

I could have increased ISO to get to a small­er aper­ture with­out increas­ing the shut­ter speed, but that would have intro­duced noise I want­ed to avoid.

Instead, I took a series of images, mov­ing the focus (by using the focus ring of the lens, more on that lat­er) a bit between each image to cov­er the legs at the front, right up to the legs at the back. Here are the two front and back images, I spare you all the 22 images in between:

As as you can see from my high­ly sophis­ti­cat­ed illus­tra­tion, we have one focus plane in the front where parts of the front legs are in sharp focus, and we have the rear focus plane with the one vis­i­ble leg in focus. The oth­er 22 images cov­er all focus planes between them, with a lit­tle of overlap.

Focus stack­ing is now the mag­ic which takes all the sharp parts of the 24 images and merges them togeth­er in an image which looks like you have a depth of field which cov­ers the com­plete sub­ject from front to back. this is the result:

So the soft­ware has not only to rec­og­nize what is sharp, but it has to prop­er­ly align all images before­hand, and it has to deal with ghost­ing and maybe dif­fer­ent light­ing con­di­tions between the dif­fer­ent shots. More on that fur­ther down.

Global Photo Club

Why do you want to use it?

We already touched on that above. If you are in a sit­u­a­tion where you can‘t get enough depth of field with one shot only, either because the shut­ter speed is then too slow, or your max­i­mum small­est aper­ture of your lens is still not small enough to get every­thing in focus, you can use focus stack­ing to still get every­thing in focus. It is a soft­ware solu­tion to increase the depth of field by stack­ing the shal­low focus planes of mul­ti­ple images. It there­fore increas­es the pos­si­ble images you can cre­ate beyond the phys­i­cal capa­bil­i­ties of your lens and cam­era combination.

Global Photo Club

When is a good opportunity to do it, and when should you avoid focus stacking?

There are sev­er­al things you need to con­trol to have a suc­cess­ful focus stack that ties in with the com­mon pit­falls, so I’ll cov­er both in this paragraph.

Some com­pli­ca­tions you might expe­ri­ence when doing a focus stack are light­ing and sub­ject move­ment. Basi­cal­ly, you need as much as pos­si­ble equal con­di­tions for each shot in the series. Keep the changes between each image to a min­i­mum. Best would be to only change the focus plane. That is not always pos­si­ble, we come to that in a second.

So what could change?

Light­ing, for exam­ple. If you have a cloudy day and it trans­forms between being sun­ny and, well, less sun­ny, the soft­ware has to han­dle dif­fer­ent exposed images besides the dif­fer­ent focus planes. That of course only if you shoot in man­u­al mode, which I would rec­om­mend. If you shoot in aper­ture pri­or­i­ty mode, the shut­ter speed might be dif­fer­ent between shots, pos­si­bly increas­ing it beyond what your sub­ject will tolerate.

Which leads to the oth­er key thing which could change between shots, that is the posi­tion of your sub­ject between shots. Even if you think your sub­ject is still, it might not be. With the moth is looked like it was motion­less, but infin­i­tes­i­mal move­ments of the anten­na or the tail were only vis­i­ble when look­ing through the images in post pro­cess­ing. The focus stack­ing soft­ware might encounter prob­lems when it tries to decide which part of which image it wants to use for the final image when it can’t align all images per­fect­ly. This is where you might need to help the soft­ware lat­er to decide. Still objects are suit­able, mov­ing things are bad.

Align­ment is anoth­er issue. Did you notice that between the left image above (the one with the front legs in focus) and the right image, there is not only a dif­fer­ence in the sharp focus plane but also in the subject’s size (the mag­ni­fi­ca­tion). That is an effect called ‘focus breath­ing’. Worth anoth­er arti­cle, but to explain it quick­ly, it is the effect that a lot of lens­es do not keep exact­ly the same focal length when focussing from near to far, caus­ing the image to dis­play the treats of that dif­fer­ent focal length. Most notable here is that when I focused to the far­ther end of the sub­ject, the sub­ject got small­er in the frame, prob­a­bly because the focal length changed to be a lit­tle bit wider.

The cam­era was still solid­ly plant­ed on my tri­pod, and I didn’t move the tri­pod between shots. You can test if your lens also has notably focus breath­ing. Just shoot two images, leav­ing every­thing the same but the focus, one focused to the clos­est dis­tance, one to infin­i­ty. Com­pare the two images. Any dif­fer­ences? Then you have a prob­lem the soft­ware has to solve try­ing to match/align the mag­ni­fi­ca­tion of all the images in the stack.

Ok, you say, then I just leave the focus ring alone and move the cam­era with the lens to get dif­fer­ent focus planes! Bril­liant! But unfor­tu­nate­ly, that can intro­duce changes in the per­spec­tive, and you again intro­duce issues the soft­ware has to solve. Here is an inter­est­ing arti­cle about the two dif­fer­ent ways to focus for a focus stack. It is not as easy as it looks.

Article about “Focus rail or focus ring?” on [zerenesystems.com]

Is it bet­ter to use a focus rail or the ring on my lens? The short answer is that it’s usu­al­ly bet­ter to use the ring. But this is a sur­pris­ing­ly com­plex ques­tion. There are a lot of fac­tors to con­sid­er and the deci­sion is not always clear-cut. There may even be …

Global Photo Club

How do you do it?

So how do you do the focus stack­ing? We have two phas­es, one is expos­ing the series of images, the oth­er is the post-processing.

Shooting the image stack

You need to shoot a series of images, all iden­ti­cal apart from the focus point. How do you do that? Get your cam­era on a tri­pod. Then you want to decide if you focus with the focus ring of your lens or use a focus rail to change focus by chang­ing the dis­tance of your cam­era to the sub­ject. If you do the lat­ter, you know what to do: put your cam­era on the focus rail and turn off your auto-focus. And as your cam­era is on a tri­pod, turn off any image sta­bi­liz­ing (in body, or in-lens, or both).

Now move your focus point to the clos­est point you want in focus. Make sure you are in man­u­al shoot­ing mode. Use a cable release for the expo­sure to reduce cam­era shake. Remem­ber, we are doing this elab­o­rate process to increase the sharp­ness of your macro images!

Now comes the tough part, you need to decide how much you change the focus point for the next image. Ide­al­ly you want some slight over­lap­ping of focused areas between the dif­fer­ent images, and you don’t want to miss areas. So if you are in doubt, shoot more images with few­er change of focus, just to make sure you haven’t missed an area. It would annoy if you have to throw away the entire series of stacked images just because you are miss­ing sharp focus in an impor­tant part of the image. As you are touch­ing the cam­era for the focus change (unless you have a ful­ly auto­mat­ed sys­tem), be extra care­ful to leave the cam­era posi­tion intact. Make sure you cov­er the whole depth of field you want to achieve.

Post-processing the images

Select your soft­ware tool of choice (see ‘Soft­ware Alter­na­tives’ below), and load the image stack. Some pro­grams do not allow raw files, so you have to con­vert the images before you can load them into the stack to process. If you have restrict­ed com­put­er resources and not much patience, you might also opt for using .jpg images, just because it is faster with small­er file sizes.

All the focus stack­ing soft­ware alter­na­tives have some means to cor­rect which part of each focus lay­er is used and blend­ed in, so you prob­a­bly have to use that and cor­rect the spots where the soft­ware made the wrong guess­es. It is cor­rect­ing the mask­ing of the layers.

Areas which often need atten­tion are the ones where images with sim­i­lar good focus have not aligned prop­er­ly, maybe because of sub­ject move­ment. The soft­ware does not know which image should take prece­dence, and it might be blend­ed togeth­er awkwardly.

So if you try out a stack­ing soft­ware, make sure you test how easy it is to blend in parts from one lay­er and hide parts from another.

Global Photo Club

Software alternatives

I used Affin­i­ty Pho­to for my focus stack. Here is a tuto­r­i­al video for how to do it (they call it ‘Focus Merging’):

There are sev­er­al alter­na­tives, all hav­ing their strength and weak­ness­es. When try­ing all the alter­na­tives, have a look at the price (obvi­ous­ly), is it a spe­cial­ized prod­uct, or do you already have a license for a gen­er­al prod­uct which can also do focus stack­ing. Can it han­dle raw files direct­ly (is that impor­tant for you?), how fast is the process if you have lots of big file stacks? How is the qual­i­ty with­out man­u­al inter­fer­ence, how easy is it for you to change which lay­er part is used? Is the soft­ware still main­tained and cur­rent, sup­port, user forum, etc. all the usu­al stuff when you try and buy new soft­ware licens­es. Maybe you also con­tem­plate about hav­ing an auto­mat­ed focus rail, then you might want your soft­ware to work with that process. So lots of things to think about.

Adobe Photoshop

Find a quick tuto­r­i­al here about how that works in Adobe Photoshop:

How-To: Focus Stacking in Photoshop on [creativecloud.adobe.com]

When we look at a scene—for instance, a land­scape with flow­ers near us and moun­tains in the distance—nearly every­thing appears tack sharp because …

Using Pho­to­shop is a bit less auto­mat­ed, but you get a bet­ter sense of what parts of the images are used by exam­in­ing the lay­er masks. A lot of pho­tog­ra­phers might already have a license for Adobe Pho­to­shop, so there might not be addi­tion­al costs involved.

Helicon Focus and Zerene Stacker

These two soft­ware pack­ages are spe­cial­ized on focus stack­ing. I haven’t used any of them yet, main­ly because I do not use focus stack­ing very often, so I didn’t want to pay for anoth­er soft­ware pack­age. But your use case might be dif­fer­ent, so get a tri­al ver­sion and check them out.

Global Photo Club

Have fun get­ting close and sharp­en your stack!

Leave a Comment