Playing around with close-up photography is a lot of fun, especially once you have invested in a dedicated macro lens for your camera.

Lexy Savvides/CNET

However, macro lenses may not be able to give you as much depth of field as you require.

You could stop your lens down to increase the depth of field, but then you may encounter diffraction. Also, to compensate for a narrow aperture, you may have to slow down your shutter speed or increase ISO to get a correct exposure. This might not be ideal in certain situations.

To get around these limitations, try focus stacking. This is a technique that's a little bit like high dynamic range (HDR) photography, where you take multiple photos and merge them together in post-processing. Instead of changing the exposure like you would in HDR, for focus stacking, you change the focus.

Focus stacking is a technique that can also be used for landscape photography.

What you need

A tripod is an absolute essential. Unless you are able to hold your camera in exactly the same position, focus stacking is next to impossible without a tripod

A digital SLR or interchangeable lens camera with a macro lens. You need these in order to make sure that you can achieve a consistent exposure by shooting in manual mode, as well as being able to manually focus. It is possible to do this with a compact camera, but you may find macro shots more difficult because of the minimum focusing distance of the lens

Step one: set up your shot

Choose your subject. Whether that's a flower, a small object or anything in between, compose your shot to your liking. It helps to have a controlled environment when shooting, or choose a subject where something like the wind will not affect how it will look.

Make sure the camera is steady on a tripod, and not able to move around at all, especially when you start changing the focus.

Compose your shot a little wider than you normally would. This is because when blend the photos in Photoshop, there will be some overlay areas at the edges of the frame that you will need to crop out for the final photo.

Put the dSLR in manual mode (exposure and focus), and meter your exposure. Make sure you don't adjust any of the exposure settings after taking your first shot; otherwise, you will need to start again.

Step two: change the focus

For your first shot, choose your point of focus. If you have the option to see expanded focus on your LCD screen, this will really help you. In the video above, we are tethering the camera to EOS Utility (Canon only). This is so there is a much bigger screen to look at for precise focusing rather than relying on the camera LCD alone.

With Live View activated on your camera's screen, use the zoom buttons to activate expanded focus.
Canon/Nikon

Take the first shot. Then, for each subsequent shot, slowly change the focus so it falls on a different part of your image. For example, depending on your subject, it might be best to work from front to back.

A subject such as a flower could involve setting your first focus point on the front of the petals, then work back progressively to the centre of the flower, and finishing up by selecting a few more points of focus at the rear.

The number of shots you will need to take depends on your aperture and how many focus points you need to adequately simulate as much depth of field as possible. A good starting point is to take more photos than you think you will need.

Remember that the wider your aperture (smaller f-stop) the more images you will need.

Step three: import and merge your photos

Take your finished photos, and import them to your post-processing software of choice. For this tutorial, we're using Photoshop CS4 and CS6 in the video, but the principle is the same in most versions.

You will need to create a single file with separate layers. Each layer must contain a separately focused shot. The easiest way to do this is to import all the images into Bridge or Lightroom, and then send them to Photoshop as layers. Find this in the Tools menu > Load Files into Photoshop Layers.

Create a single file with multiple layers, each containing a separately focused shot. This is what your layers palette should look like, but the number of layers will vary on how many photos you have taken.
Screenshot by Lexy Savvides/CNET

Select all the layers on this palette, and then head to the Edit > Auto-Align Layers option.

Leave this option on "Auto".
Screenshot by Lexy Savvides/CNET

Press OK, and Photoshop will automatically align your photos to compensate for any slight changes in camera orientation when taking the images.

To blend all the photos into one, keep the layers selected like before and head to Edit > Auto-Blend Layers. Keep this one set to the "Stack" option and press OK.

After a little processing time, you should now be presented with a perfectly focus-stacked image. Crop the image as needed to remove any of the edges of the photo that were altered when performing the automatic alignment option.

Lexy Savvides/CNET

Focus stacking requires patience, but it's a great technique that produces tack-sharp macro (and regular) photos in most situations.