Overcoming the Challenge of Depth of Field in Macro Photography

As anyone who has experimented with macro photography will know, this style of photography, and more specifically the nature of the subjects and lenses used, makes achieving a suitable depth of field very challenging.

Some photographers may like to produce the style of image where only one small part of the image is in sharp focus, with the rest receding into a smooth, surreal blur.

This is well and good, but sometimes one simply wants all of the details in a macro image to be rendered in sharp focus.

Sufficient depth of field is quite difficult to achieve in macro photography for two main reasons.

Firstly, the subjects often shot are typically small, which means that one needs to get close to the subject, using a lens whose magnification is life-size (or greater); and secondly, a longer focal length is needed, especially if the subject is a critter which will run or fly away if a photographer gets too close.

Longer focal lengths and very short subject distances both reduce depth of field, and do so more dramatically when combined.

One counter-measure available is to stop the lens's aperture down to a very narrow aperture.  This sounds good, but there is a hidden danger: diffraction.

When a lens's aperture is stopped down to an extremely narrow aperture, light rays entering the lens at various oblique angles must bend dramatically to enter the narrow aperture, and then find their way towards the focal plane.

At very narrow apertures, diffraction causes a loss of fine detail in images, resulting in a softer appearance.  In macro photography, where fine detail is often the very subject the photographer wants to capture, diffraction is more problematic than it would be in other forms of photography, such as landscape photography.

So, with a combination of a long focal length, short subject distance and a practical limitation to how far down one can set the lens's aperture without degrading the quality of the image, how does one gain more depth of field?

It is easier than one would think, and does not require any special software if you already have Adobe Photoshop.

The technique is called focus stacking, and it involves capturing multiple images of the subject shot multiple times with different focus distances, and digitally blending them.

Each image captured must be framed identically, but what differs is the field of focus.  After each image is captured, it is simply a matter of adjusting the lens's focus ring by a small amount to render another part of the image in focus.

Perhaps there might be equipment available which can adjust the focus ring in precise increments, but I have never looked into it, in my experience of having produced three macro images using this technique, I have found that the adjustment of the focus ring can be done manually, and still produce excellent results.

At the capture phase, I recommend using a tripod so that precise framing can be achieved throughout the numerous images that will be captured.

Using the live view mode on the camera allows for a much better view of the lens's plane of focus, and also reduces any potential bumps resulting from contact with the camera's optical viewfinder.

I also recommend the use of a remote shutter release to further avoid needing to make any contact with the camera.

Some contact with the camera will be required, as without a device to rotate the lens's focus ring, it will need to be touched.  For that reason, care must be taken so that the camera is not bumped out of alingment.

How many images need to be captured?  That depends on the subject, the subject distance, the lens's focal length, and how much adjustment of the lens's focus ring is required to capture a series of images in which the closest subject matter is in focus, right through to the furthest subject matter.

Yesterday I photographed the intricate details of a rose laden with water droplets, and rather than opting for the arty shallow depth of field prevalent in many macro images, I wanted rich details in sharp focus throughout the image.

For my macro photography, I use a Canon EF 180mm f/3.5L Macro USM lens, which is challenging to use at the best of times, but I also attached my Canon Extender EF 2x II, which doubles the focal length.

I was therefore shooting a relatively small subject at a focal length of 360mm, with not a great deal of distance between the lens and the subject.  The result is not much depth of field.

One might think that I would need to shoot a dozen or more images to capture the full field of focus, but in fact I needed only seven images.

To produce a focus-stacked composite image in Photoshop, the technique is as follows:

  1. After raw conversion, load all of the raw files into Photoshop.
  2. One at a time, and in sequential order (this is important), copy each image to the clipboard, and then paste it as a new layer into the first image.
  3. Rename the layers using a logical naming scheme (eg, IMG_0001, IMG_0002, etc.).
  4. In the layers pallette, select all of the layers.
  5. Click the Edit menu, and select 'Auto-Align Layers'.
  6. Set the Projection set to 'Auto' and click OK.  Photoshop will align the layers.
  7. Click the Edit menu and select 'Auto-Blend Layers'.
  8. Make sure that 'Stack Images' is selected, and click OK.

Depending on the bit depth, dimensions and number of images to be stacked, it could take a while for Photoshop to complete the focus stacking.

The result will be a stack of layers with layer masks on each.  Photoshop's focus stacking algorithm selects the in-focus subject material in each image and masks out the out-of-focus areas such that the resulting image is sharp throughout.

The next step is to create a new layer for the composite of the stacked images.

From the top layer, press Cmnd-Alt-Shift-E on a Mac, or Ctrl-Alt-Shift-E on Windows.  This keyboard-only command will produce a new layer of all lower layers without discarding the layers.  This is not the same as the 'flatten image' command, which I never recommend.

Once the composite image has been captured as its own layer, proceed to apply any other post-processing as desired.

Now, let us look at my results from yesterday's rose image.

Firstly, here is a montage of my seven source images, and the resulting composite image Photoshop produced using the automatic layer blending option.

Image: Focus-Stacked Rose

Focus-Stacked Rose

As can be seen in the above screen capture, images 1 to 7 all have different planes of focus.  The composite image in the lower right shows the raw result from Photoshop's focus stacking algorithm.

One caveat of which to be aware is that the technique results in a softening around the edges of the frame, so it will be necessary to marginally crop the image.  For that reason, I recommend composing so that no critical subject matter is positioned close to the edges of the frame, as it may be damaged by the 'soft border'.

Now, here is the final image after I completed my post-processing, which included cloning distracting spots, detail enhancement using Calvin Hollywood's 'Freaky Detail' technique, cloning out of distracting spots, and contrast and sharpening adjustments.

Image: Petals


Hopefully this article has been helpful in illustrating how a macro photographer can overcome the challenge of very limited depth of field by carefully executing the capture of multiple frames of the same subject at different planes of focus, and using one of Photoshop's in-built functions to digitally composite the in-focus subject matter in the multiple frames to produce a rich, detailed image with everything rendered in sharp focus.

Published on Sunday, 16 February, 2014.