How To: Macro Photography with Deep Depth of Field

Macro photography—the process of shooting extreme close-ups of things—has been popular for as long as there have been cameras. But as you might expect, digital technology, both hardware and software, has made it possible to shoot macro photographs that would have been impossible to achieve with film. And one of the most important macro-related innovations has to do with depth of field.

Technically, a macro photo is one that captures your image at a 1:1 scale. That is, the size of the object on your image sensor is actual size. (Going to higher magnifications is also considered macro, of course.)

To shoot a macro photo, you need a lens that’s capable of focusing close enough to your subject that you can achieve this 1:1 or better size. With most lenses, if you’re close enough to your subject to get macro scale, you’re too close to actually focus the shot. Macro lenses, therefore, are capable of focusing at incredibly short distances.

As you get closer to your subject, though, your depth of field drops off tremendously. For example, when shooting with a 1x macro lens at f/4, your depth of field will probably be around half a millimeter!

Consequently, most macro photos have depth of field like the image in figure 1.

FIGURE 1: When you get in close, your depth of field will shrink to fractions of a mm. Getting an image with deep focus becomes very complicated.

In fact, we’re so used to macro photos having shallow depth of field that we will often interpret shallow depth of field as an indicator of scale. For example, if I shoot a landscape shot with a tilt/shift lens, which allows me to greatly shorten the depth of field, the result ends up looking like a toy, or a miniature diorama.

FIGURE 2: We’re so used to close-ups having shallow depth of field, that if we shoot a landscape with extremely shallow depth of field, it looks like a miniature.

This toy effect is simply because our brain understands that when you look at something up close, you see very shallow depth of field. Since the depth of field in figure 2 is shallow, my brain assumes that it must be very small, and that I must be standing very close to it.

With digital post-production, though, we can combine multiple images that each have shallow depth of field into a finished image with very deep depth of field.

FIGURE 3: This is the same raspberry that was shown in Figure 1, but now I’ve shot it with deep depth of field using some specialized hardware and software.

Focus Stacking

Conceptually, the process here is pretty simple. I shoot a picture where the very front of my subject is in focus. If my depth of field is half a millimeter, then I move the camera forward half a millimeter and take another shot. Then I repeat this until I have shot in-focus slices of the entire object. Those images can then be combined to create a finished image.

You might think “why move the camera? Why not just change focus to move the slice of focus along the object?” This technique would work with large objects, but remember that every time you focus you’re actually changing the focal length of your lens a tiny bit. And when you change focal length, you change the field of view in your image. While you don’t notice this with everyday shooting, with macro shooting, even a tiny change in field of view alters the sense of space in your scene to a very large degree. So, rather than simply re-focus for each slice, we have to either move the camera or the subject.

For a little over a hundred dollars, you can buy a focus slider, which allows you to simply turn a knob to move your camera forward or backward (or side-to-side) in very tiny increments. So, you can position your camera, shoot, then slide it forward, shoot again, and so on.

While this is an entirely viable way to shoot a stack of images, in practice it’s pretty hard to pull off. If your depth of field doesn’t overlap from image to image, then your merge will have unfocused areas. Also, depending on how shallow your depth of field is, and how big your subject is, you might need to shoot anywhere from 30 to 70 shots to get full coverage of your subject.

Much easier than a manual focus rail is the StackShot, a completely automated system that handles all aspects of shooting a stack for macro images that can be merged into a finished shot with deep depth of field.

The StackShot lists for $525 and includes an automated rail, a control box, and the necessary cabling to rig it all together. You’ll need to also purchase a remote cable that works with your specific camera. In addition to the StackShot, you’ll need a sturdy tripod, and possibly some lighting.

To use the StackShot, you mount it on your tripod, and then attach to your camera to the StackShot’s mounting plate. Using controls on the StackShot, you can drive the camera forward and backward. To set up a session, you establish a start point and an end point, and then tell the StackShot how much travel you want between each frame. When you start the operation, the StackShot automatically moves the camera the specified amount, and takes a frame at each interval.

When shooting at extremely short distances, vibration and camera shake become extremely critical factors to manage. I’ve found that someone walking on the other side of the room can throw off the sharpness of my images, even though I can’t actually feel any vibration. The StackShot lets you program pauses throughout different parts of the cycle to give the camera time to stop shaking, and it’s very easy to change the duration of each of these pauses. Employing mirror lockup, or leaving your camera in Live View mode can help further reduce vibration.

You’ll probably also find that, as you get in very close, you simply don’t have enough light to get a good exposure. Because vibration is already a problem, you’ll want to keep your shutter speeds as short as possible. Fortunately, modern digital cameras offer great performance at high ISO, but you’ll still probably need some lighting to get good exposure.

I have a Canon Twin-Light flash setup that is designed specifically for macro shooting, but on-lens flashes like this don’t work well for focus stacking. First, they don’t reliably deliver equivalent flash exposure for every frame. Depending on how quickly you’re shooting, the flash may not have time to completely recycle, so you might find every third or fourth frame underexposed. But also, as the camera moves, the flashes move as well, which means you’ll have inconsistent shadows from frame to frame. So, it’s best to stick with continuous lighting.

Fortunately, because macro subjects are so small, you can usually get away with small lights. Even a simple copy stand may provide all you need to get your subject covered with enough illumination.

Products like Modahaus’ Tabletop Studios make it easy to get a small area lit with smooth, even lighting.

Some other important things to consider:

* Frame wide. Because your camera position changes, some images will be cropped more than others. This difference in field of view will have to be cropped out, so be sure to pad your composition with some extra space around the edges.

* Because of the inherent need to crop, choose your closest position as your starting point, and then pull back. If you pad that close-up shot appropriately, you’ll be assured of getting the image content that you want when the camera is at its closest point.

* Shoot raw + JPEG. You’ll want raw files both for better white balance control, and to recover any overexposed highlights before you merge your shots. However, as you’ll see, performing the actual merge can take a long time, so shoot JPEGs as well as raws. I set my camera for raw plus a medium pixel count JPEG. I can take the JPEGs and merge them quickly to see if I like the shot. If I do, then I can go back and spend the time to merge the raw files.


Photoshop CS5 and later can merge stacked images. From Bridge, select the images you want to merge and choose Tools > Photoshop > Load Files Into Photoshop Layers.

This will do just what it says: it will take each separate image and stick it on a separate layer in a single Photoshop document. Next, select all of the layers in the Layers palette, and then choose Edit > Align Images. Accept the default “Auto” projection and align the images. This alignment is necessary because of the changing camera position from shot to shot.

With the separate layers still selected, choose Edit > Auto Blend layers. Make sure Stack Images is selected, hit OK, and then wait. When the operation his completed, you’ll see a Layer Mask on each of your layers. These masks are constructed to reveal only the part of each layer that is in focus.

Figure 4: Once your image is merged, you’ll have custom Layer Masks attached to each layer.

Note that, in CS5, Photoshop doesn’t necessarily refresh the screen when it’s done with the Auto-Blend. So, if you see the progress bar go away, but your image still has shallow depth of field, just zoom in and out to force a screen redraw.

Photoshop is not the only software option when it comes to merging. Helicon Focus is a stand-alone application designed specifically for merging stacks of differently-focused images. Helicon Focus is faster at merging than Photoshop is, but it’s also pickier about source material. If there’s too much exposure variation from image to image, it may not be able to perform a merge.

However, it also lets you do something that Photoshop can’t do: when it’s done merging, it can also output a 3D rendering of your scene. It’s not always perfect, but it’s an interesting way to visualize your object.

Needless to say, this is a lot of gear just to get a shot of a piece of fruit. However, if you’re serious about macro photography, and shallow depth of field sometimes frustrates you, the ability to shoot these deep depth of field images can open up a new world of subject matter.


Posted on: January 9, 2013

6 Comments on How To: Macro Photography with Deep Depth of Field

  1. Thanks for a great article, Ben! Now I feel compelled to add the StackShot system to my arsenal. (Of course, it’s a “want” rather than a true “need,” but my photography accessories fall more into the “want” category more often than not!

  2. Thanks for the helpful article. I really enjoy macro photography but struggle with the balance between depth of field and sufficient lighting. I never really considered focus stacking for macro. Now I have a new item on my wish list!
    Elisabeth Degallier

  3. It takes some patience to work with big groups of stacked images (I’ve been processing all day on a shot with 240 separate images – 12 gb of data for one final image!) but the results are worth it. I’ll be showing more of this process in detail in a forthcoming course on macro shooting. -Ben

  4. The biggest advantage of Helicon over Photoshop is the ability to retouch back into the image where the software was not accurate. Editing the masks in Photoshop is a pointless task, especially when you are working with 30, 60 or more layers.

    Raymond St Arnaud

  5. …when you change focal length, you change the field of view in your image…

    When you move the camera you also change the field of view!
    So instead of buying expensive hardware why not try a software solution to automate the re-focus process?
    One such (if you’re a Nikon shooter) is “Control My Nikon”. It costs less than $30, but of course you’ll still need Photoshop, Helicon Focus, or any of several other programs to do the stacking.
    Take a look at it here:
    (Be sure to check out their Focus Stacking tutorial.)

    Hope this helps – Greg Peterson

  6. Hi Ben.

    Can you share how to calculate the Depth of Field for the Macro Photography? Actually I need the DoF to be able to fill in the Distribution per step for the Stackshot. Unfortunately the DoF application does not work for Macro Photography. There is a guide for DoF for Canon MP-E 65mm lens, but I use Canon 100mm f/2.8L instead.

    Best regards,

    karya setia

Leave a comment

Your email address will not be published.