Extended Depth of Field Photography of Insects et.al.

Rik Littlefield (email rj.littlefield at computer.org)
Last major modification Aug 7, 2005
Last minor edit May 22, 2007


Much of the material described below has been condensed into an article published in the Summer 2005 issue of News of the Lepidopterists' Society.  You might want to start there and then come back here for earlier material that may be more complete but draftier.


Shallow depth of field is a problem when photographing small things.  Stopping down the lens is not a solution.  Beyond some optimum point, stopping down the lens reduces geometric blur but makes the entire image fuzzy due to diffraction effects.  When photographing something the size of a housefly, the optimum point is typically f/8 or wider, and the useful depth of field ("depth of detail") for a single picture is often 0.1 mm or less.  The problem becomes more severe with smaller subjects.

Recent advances in digital photography software address this problem by allowing the photographer to shoot a "stack" of images, sweeping the plane of ideal focus across the subject, then combining the in-focus portions of each image to construct a final image that is sharp everywhere.  Using current computers and digital cameras, it is quite practical to use 100 or more different focus planes, thus extending useful depth of field from 0.1 mm to 10.0 mm (for example).  Of course, this technique requires that the subject does not move while the image stack is being shot.  Only dead or thoroughly immobile specimens can be used.


The software used here is CombineZ5, a free program written by Alan Hadley.  Several commercial products, notably Helicon Focus, can do pretty much the same job and are significantly easier to use.  However, for difficult subjects such as overlapping hairs, I have gotten the best final results using CombineZ5.  (Tuning parameters for new situations is a bit tricky, but with experience, good results should become easy to obtain.)


Here is the head of a Sulphur butterfly (Colias, species unknown), using a stack of 53 frames separated by 0.005 in (0.125 mm), shot at f/8 using a 50mm El Nikkor enlarging lens, reversed.  (This is the optimum aperture for this lens at this magnification.).  Subject width is about 6 mm.

Run your mouse over the image to see a single frame from the camera.
Head of Sulphur butterfly, extended depth of field composite.

A stereo pair of this image can be seen at http://www.janrik.net/insects/ExtendedDOF/SulphurStereoDE.html .

The original of the above image is 3000x2000 pixels and contains much too much detail to show on this web page.  Here is a small crop from next to the eye.   Note that this level of detail is maintained over the entire head of the butterfly.  Click on this image to open full size in a new window.  (Depending on which browser you're using, you may need to click another button or two to see it full size, or you can save it to disk and look at it with your favorite image viewer.)

Here's another example -- part of the eye and labial palp of a Painted Lady Butterfly.  Subject width is about 3 mm.  92 frames spaced by 0.001 inch. Click on the image to open full size in a new window.  (The full size image is 1480x980 pixels.)   This particularly difficult test case is discussed in more detail on its own page.

Here's the egg of an Icaricia lupini butterfly ("Lupine Blue", despite that it eats only buckwheat (Eriogonum)).

See stereo renditions and further explanation on this page.

Physical Setup

See photo below.  The Canon Digital Rebel (D300) camera is held in a 2-axis machining vise, permitting convenient lateral and focusing movement in calibrated 0.001 inch increments.  The specimen is held in an ancient homebrew positioning device that provides a similar degree of control over vertical movements.  The lens is mounted on a homebrew collection of bellows, extension tubes, and Pentax-thread adapters.  Click to open full sized.

Processing Notes

In many cases, CombineZ5's "Do Stack" macro does a fine job.  However, in cases with dense overlapping hairs or bristles, Do Stack can get confused and construct an image in which background objects appear to be in front of foreground objects.  That problem can often be corrected by using the "Do Average and Filter" macro.  The images shown on this page were not processed using "Do Stack".  Instead they were done with a modified "Do Average and Filter" macro, using Highpass(1000,40).  The images were then denoised using Helicon Filter (not Helicon Focus) with settings (60,60,60).  The composite for the Sulphur head was contrast-balanced and color-balanced against the single frame using Photoshop Unsharp mask 25% at 60 pixels, plus a Levels adjustment layer.

The full-size images contain a couple of white streaks caused by isolated "hot pixels" in the camera.  For highest quality, these artifacts would be removed either by manually cleaning up the final images, or by preprocessing the source images to patch in the defective pixels based on their surroundings.

Claims and Disclaims

The work presented here is a personal publication of capabilities and techniques developed by the author.  You may link to this page, but please do not reference in archival publications; contact the author instead.  All images and text are copyright Rik Littlefield, 2005.

-  -  -