_KOC3038

Shooting and editing macro photographs using the focus stacking technique.

When a single shot won’t get everything in focus, try stacking a series of differently focused shots of the same scene. It’s easy, it’s fun—and it can be very useful.

This technique is most often used for close-up macro work, but can be used in any type of photography where you want objects in the foreground, center, and background to be equally sharp.

This introduction to Focus Stacking centers on the manual method – available to anyone with a camera and a lens that can focus on all the items you want to be sharp in the final image. You can also capture layers through microscopes to use with this technique. Automated tools are also available, as discussed at the end of this blog post.

How to Create A Stacked Focus Image; Shooting before Stacking

In the image above, shot with a close-up lens at its optimal aperture, a particular point of the image is in focus, but much of the area behind and ahead of the point of focus is very soft. Using a smaller aperture would cause more of the image to appear sharp, but much of the image would still be out of focus.

You might try using a still smaller aperture , such as f/16, f/22 or even smaller, but image quality will begin to degrade as the lens is further stopped down, and even then, not all the image will come into focus. This is why we stack, to get the whole thing sharp. 

Find the Best Aperture for Each Lens Before Your Shoot

Focus stacking

Every lens has an optimal aperture, which delivers the best possible results. It’s a really good idea to find out what your optimal aperture is when making focus stacks. Multiple lens testing services provide results online, showing what their tests reveal about the very best aperture for a particular lens, so it’s easy to look up. If you can’t find your particular lens reviewed, the general rule of thumb is to use an aperture 3 f/stops down from wide open. The images in this article were all created with a 105mm Micro-Nikkor lens, at f/10, the best aperture for this lens, for this kind of work.

How can you preserve the quality of the lens’s optimum aperture and yet get the focus depth desired? Shoot multiple images, focusing at multiple different points in the same scene, and stack them together in the computer.

For best results, use all the techniques you know to get a sharp image. A good tripod is essential to execute and deliver high quality stacked images, and a cable release is strongly recommended.

How to Shoot your Stack of Images

Focus stacking

Compose your image carefully, using your tripod. Next, focus on the closest point you wish to have in focus, and make sure that the framing and composition are to your liking. This closest-focused frame shows the boundary of the final image. As you change focus from front to back, the field of view will widen. Since you want everything from front to back to be sharp, the extra part around the edges of the frame which appears as you focus further back won’t be included in the final image, because this extra area isn’t included in the first frames you shot focused most closely.

The image sizes will shift slightly, or a lot, as you focus. This varies depending on the distance between the lens and the you are to the object(s) you’re photographing. As you focus front to back, watch for all the points you want to be sharp. Shoot an image for each of those points, and all the areas in between. You’ll need to shoot enough steps in between to give Photoshop room to make smooth transitions. When in doubt, shoot too many rather than too few frames. You can always remove some frames from the stacking process, but it’s impossible to put sharp areas back in if you don’t capture them before stacking.

Focus stacking

When Photoshop matches up the images you’ve created to stack them, it works in a two step process. The first step aligns all the images correctly. (Note: Photoshop will tell you if it can’t do the alignment. If that happens, check each frame to see if you’ve included a frame that doesn’t match the rest.) In step 2, Photoshop automatically finds and blends the sharpest points of each aligned frame, masking out the soft areas.

Photoshop compensates for the change in size of the various frames by scaling and skewing some frames to match others. There’s a point past which compensation can’t be done, simply because there’s not enough at the edges of the frames of the front of the stack to shrink into alignment with the images shot.

You can see this in the first image below. The screen capture shows the moment after all the frames are aligned, but before they’re blended. The area that’s brighter white will end up being the area of the final frame, and you can see that this frame very closely matches the most closely focused image shown earlier. When the stack is composited into one image, the areas outside the edges will show up as blurs, which can’t be fixed in Photoshop. If you can live with the crop, great. It is, after all what you saw as you composed and focused the first frame. If not, you’ll need to check out the advanced tools later in this article.

Screen Shot 2015-06-21 at 4.32.00 PM

 

How to Stack your Shots into One Image

Bridge Bolts

All of the images need to be opened into one file, in multiple layers. There’s an automated way to do this, and a tedious manual way. Here are the steps for the fastest method, with screenshots. You really don’t want to open each image individually and do this manually, do you? The images are of a single bolt I found in a wall in the ghost town of Rhyolite, near Death Valley.

  1. Open Adobe Bridge.
  2. Drag the folder of images to be stacked onto the icon of Adobe Bridge, or navigate from Bridge (File Menu/Open/folder…).
  3. Highlight the images you wish to stack.
  4. Under the Tools menu, select Photoshop/Load Files into Photoshop Layers.
  5. Each image will open into the same file, into a separate layer, in Photoshop.
  6. Once all the images are open, Save your file.
  7. Open the Layers Panel, select the first layer, hold down the Shift key, and click on the last layer. This selects all the layers in between.
  8. With all the layers selected, under the Edit Menu, select Auto-Align Layers.
  9. In the Auto-align dialog that appears, select Auto, then OK.
  10. Photoshop will align the layers; depending on the size of your files, and the speed of your machine, you may find this takes a bit of time. When aligned, Save again.
  11. Next, under the Edit Menu, select Auto-blend Layers. All the layers in the Layers Panel must still be selected.
  12. In the dialog that appears, select Stack Images, and be sure the checkbox for Seamless Tones and Colors is selected.

Layers Selected

Photoshop will find the sharp sections of each layer, and create a mask for each layer to hide the soft portions. When the masking is finished, the image should show sharp from front to back. Notice that it appears a bit more contrasty and saturated than the first frame shown previously. In this example, the tip of the bolt as well as the metal plate behind it and all points in between are sharp. However, there are artifacts in the composited image, at the top and bottom edges, as well as just above the top edge of the square nut.

Note: The more individual frames you use to create a layered image, the more your system’s resources are strained. Be sure you have lots (and lots) of RAM available, have closed other programs, are using a scratch disk with enough space, and have lots of empty space on your hard drive. Save often; surprise crashes have been known to happen more than you’d like when using this technique.

Finishing Touches; How to Edit the Stacked Image

Rhyolite Stack before touchups

We’ve already discussed cropping the image to remove blurred sections at the edges of the frame. In the composite Rhyolite bolt image above, it’s possible to crop the bottom and top edge slightly. What to do about artifacts if any show up, such as the red areas above the top edge of the nut? The area is is blurred, not sharp, even though one of the frames has the red rust clearly sharp in the frame. You could change some of the settings in the two dialog boxes (Auto-align and Auto-blend) and try again, but if that fails, here’s how to retouch the image.

First, create a composite image above the merged layers (still selected) by typing Cmd(or Ctrl on Windows)+Opt(Alt) + Shift + E. This gives you a complete composite layer on which to retouch. Second, return to Adobe Bridge, and find the frame which has this part of the image clear and sharp. Open it in Photoshop, using the same settings as before, and draw a marquee around the area that’s sharp. (You may need to do this separately with each part of the layer that needs to be copied to the composite.) Make sure you have this image and the composite image opened as two separate floating windows, so that you can drag from one to the other.

Focus stacking

Copy the marquee selection from the single image to the composite image. Do this by copying, then switching to the composite image, and Paste in Place (Cmd(Ctrl)+Opt(Alt) + Shift +V). Using this variant of the Paste command causes the copied area to land in the exact same spot as in the original image.

This layer has been scaled down to match other layers, and won’t match exactly until we make some adjustments. Select only this new, copied layer in the composite. Change the layer’s opacity (top right area of the Layers Panel) to 30% or so, adjusting so you can see well enough to line up the two layers.

Then, type Cmd(Ctrl) +T, which invokes the Free Transform tool. With this tool, while holding down the Shift key to make sure adjustments are proportional, scale the selection to match the image underneath. When you have it perfectly matched, which you check by moving the opacity back to 100% and back to 30% a couple times, hit the Enter key to lock in the transformation. Save your work.

Sometimes, these pasted-in place selections will need a bit of erasing around the edges to get rid of excess areas, out of focus. As you can imagine, this can be a bit time consuming.

Taking Focus Stacking Further

Focus stacking

Focus stacked photo with a startlingly deep depth of field

People who have need of speedier focus stacking, or who detest spending time retouching, can invest in tools that take focus stacking to the next level. These tools come in two groups.

Hardware

A quick way to solve the problem of layers not matching up due to layer shrinking exceeding the ability of the files to support perfect matches is to move the camera, instead of the focus. In this approach, the lens is focused on one point, and doesn’t change. Instead, the whole camera is on a geared platform, which can be moved in very small adjustments. There are manual devices, such as these from Really Right Stuff and automated tools, which move either the lens focus or the camera in automated steps after calculating the number of steps needed for the perfect focus stack such as these:

Promote Control

Focus Stacking

Software

If you’re not ready to invest in additional hardware just yet, there are three pieces of software available that let you improve your stacking quickly and easily, adding some significant improvements over the basic stacking tool available in Photoshop. They are:

Zerene Stacker

Helicon Focus

Combine ZP (Windows only)

The first two offer free trials, the last is free, though it does not appear it’s being updated anymore.

Conclusion

Focus stacking

Focus stacking is a useful technique for many photographers. Basic tools for creating focus composites are included in Photoshop, and more advanced tools are available, both software and hardware. Good results can be obtained working just with Photoshop, with careful selection of subjects and equally careful attention to composition and technique. For more advanced tools, you’ll need to invest time and money to find the best tools to match your workflow’s needs.

If you’d like to save this article for later reference or to print at home, you can download it as a PDF for free courtesy of Breathing Color by clicking here.

 


Kevin O’Connor helps design and test software, is a graphic designer and photographer for multiple clients and companies, and fixes people’s (and companies’) color.

He has consulted to multiple companies, including Apple, Sony, Fujifilm USA, and X-Rite. He loves teaching good color practices to enthusiastic learners.


 

Have a Printmaking Question For Kevin?

Get Your Question Featured
on the #AskBC Podcast

We are going to feature Kevin on an upcoming episode of the podcast and would love to have him answer your color profiling questions.

If you have a question for Kevin just click the button below and leave a question.

CLICK HERE To Ask Your Question