Technical Advanced

Focus Stacking

A post-processing technique in which multiple photographs of the same scene, each focused at a different distance, are combined into a single image with sharpness extending from the nearest foreground to the farthest background — exceeding the depth of field achievable in any single exposure.

What Is Focus Stacking?

Every lens has a fundamental limitation: at any given aperture, only a finite zone of the scene is in sharp focus. Stopping down to f/16 or f/22 extends this zone but introduces diffraction softening that degrades the entire image. Focus stacking overcomes this trade-off by capturing multiple frames at the lens’s sharpest aperture — typically f/5.6 to f/8 — each focused at a different distance, then combining the sharp regions from each frame into a single composite with front-to-back sharpness.

Before focus stacking, the technique existed only in concept. Photographers and microscopists understood the limitation and worked around it by stopping down to the smallest practical aperture and accepting the diffraction penalty. The first practical implementations appeared in scientific microscopy during the 1990s, where automated stage movements could shift the specimen by precise micrometer increments between captures. Consumer photography adopted the technique after Adobe Photoshop CS4 introduced auto-blend layers in 2008, making stack alignment and blending accessible without specialized software.

After focus stacking became practical, entirely new genres of photography emerged. Macro photographers could capture insects with every facet of their compound eyes and every leg joint in sharp focus — images that no single exposure at any aperture could produce. Landscape photographers could render a flower 30 centimeters from the lens and a mountain range at infinity in the same frame, both critically sharp. Product photographers could deliver front-to-back sharpness on complex objects without stopping down to diffraction-limited apertures.

How It Works

The process has three stages: capture, alignment, and blending.

Capture: The photographer takes a series of images shifting the focus point progressively from the nearest subject to the farthest. The number of frames depends on the depth of the scene, the aperture used, and the magnification. A macro subject at 1:1 magnification and f/5.6 might require 50 to 100 frames because the depth of field per frame is less than 0.5 millimeters. A landscape stack from a foreground 1 meter away to infinity at f/8 might need only 5 to 8 frames because each frame covers meters of depth.

Focus step size is critical. Each successive frame must have its sharp zone overlap with the previous frame by at least 30-50%. Gaps between sharp zones produce visible bands of softness in the final composite that cannot be corrected. The depth of field at each focus distance determines the maximum step size. At 1:1 macro magnification and f/8, depth of field is approximately 1mm — so focus steps should not exceed 0.5-0.7mm.

Automated focus bracketing is built into many modern cameras. The Olympus OM-1 Mark II, Nikon Z8, Canon R5 Mark II, and Fujifilm X-T5 all offer in-camera focus bracketing that captures a user-defined number of frames with a specified focus step size. The camera advances focus by a consistent increment between each shot, typically firing at rates of 5 to 15 frames per second. Some cameras (OM System) perform the stacking in-camera, outputting a finished composite JPEG alongside the individual RAW frames.

Manual focus bracketing remains necessary for some scenarios. Using a macro rail — a precision platform that moves the entire camera forward or backward in measured increments — provides more consistent results than rotating the focus ring, which changes magnification slightly at each position. Quality macro rails offer graduated markings with 0.1mm precision. The photographer advances the rail by a consistent distance between each capture, shooting on a remote trigger to avoid camera shake.

Alignment compensates for the slight changes in magnification, perspective, and position between frames. As the focus distance changes, the image magnification shifts subtly — a phenomenon called focus breathing. A 100mm macro lens may effectively zoom from 98mm to 103mm across its focus range. Alignment software scales, rotates, and translates each frame to match. Adobe Photoshop, Helicon Focus, and Zerene Stacker all perform this step automatically with sub-pixel accuracy.

Blending selects the sharpest region from each aligned frame to build the final composite. The software evaluates local contrast at each pixel position across all frames, choosing the frame with the highest contrast (sharpest detail) for each area. Two primary blending methods exist: weighted average blending smoothly transitions between frames and handles overlapping sharp zones gracefully; depth-map blending creates a binary selection for each frame and works better for well-defined focus planes.

Practical Examples

Macro photography: A 10mm beetle at 2:1 magnification demands 80 to 120 frames at f/5.6 to achieve full-body sharpness. Mount the camera on a motorized macro rail (such as the WeMacro or Cognisys StackShot) set to advance 0.1mm between each frame. Total depth covered: roughly 8 to 12mm. Capture time: 20 to 40 seconds at 3 frames per second. The resulting stack reveals detail invisible to the naked eye — individual hairs, surface textures, and structural coloration patterns across the entire subject.

Landscape photography: A classic foreground-to-infinity composition with a wildflower 50cm from the lens and a mountain range at several kilometers. At f/8 on a 24mm lens, the hyperfocal distance is approximately 2.4 meters. A single exposure focused at the hyperfocal distance renders the foreground flower soft. A 3-frame stack — one focused on the flower at 0.5m, one at 2m, one at infinity — provides sharpness throughout. Shoot on a tripod with a 2-second timer between frames to minimize camera movement.

Product photography: A wristwatch at 1:2 magnification requires sharpness from the crystal face to the clasp — roughly 25mm of depth. At f/8, depth of field per frame is about 3mm, requiring 8 to 10 frames. The controlled studio environment eliminates the primary enemy of focus stacking — subject movement. Consistent lighting across all frames ensures seamless blending.

Mineralogy and gemstone photography: Crystal specimens with complex three-dimensional geometry at 3:1 to 5:1 magnification require 100 to 200 frames to capture every facet. The translucent nature of many crystals creates unique blending challenges, as the software must handle both surface detail and internal structures visible through the material. Helicon Focus’s Method B (depth map) handles these cases more reliably than weighted average approaches.

Advanced Topics

Subject movement is the greatest enemy of focus stacking. Wind moving a flower, an insect shifting position, or water flowing through a stream between frames creates ghosting artifacts in the composite — semi-transparent duplicates or smeared edges where the moving element occupies different positions in different frames. Solutions include shooting at the highest frame rate possible (reducing the time window for movement), using electronic shutter to eliminate vibration, and shooting at dawn when wind is typically calmest. For live insects, some macro photographers use a cooling chamber to temporarily slow the subject’s movement.

Diffraction comparison illustrates why focus stacking exists. A single frame at f/22 on a Micro Four Thirds sensor (where diffraction becomes visible at f/8) loses approximately 40% of the lens’s peak resolving power. A focus stack shot at f/5.6 — the same lens’s sharpest aperture — retains full resolving power across the entire depth, producing a composite that is meaningfully sharper at every point than the f/22 single frame.

Panoramic focus stacking combines two techniques. The photographer captures a multi-row, multi-column panorama where each tile position includes a focus bracket. A 4x3 panorama with 5 focus depths per position yields 60 individual frames. Each position is stacked first, then the 12 stacked tiles are stitched into the final panorama. The result is a gigapixel-class image with infinite depth of field — used in fine art landscape photography and museum documentation.

Computational stacking in smartphones is emerging. Apple’s macro mode on iPhone 13 Pro and later captures a rapid burst and computationally selects the sharpest focus plane. Google’s Super Res Zoom incorporates multi-frame processing that simulates extended depth of field. These implementations are rudimentary compared to dedicated stacking workflows but demonstrate the technique’s migration from specialist skill to automated feature.

Focus stacking with moving cameras is possible using handheld burst sequences and alignment software robust enough to handle perspective changes. Shoot at maximum frame rate while slowly rocking the camera forward or backward to shift the focus plane. Helicon Focus and Zerene Stacker can align and blend these handheld stacks, though the keeper rate is lower than tripod-based work. This technique is useful for field macro photography where tripods are impractical.

ShutterCoach Connection

ShutterCoach recognizes when your macro or close-up photographs would benefit from focus stacking by analyzing the depth of field relative to your subject’s depth. When it identifies images where critical elements fall outside the sharp zone, it explains the focus stacking technique and recommends specific settings — aperture, number of frames, and step size — based on your lens, magnification, and subject, helping you plan and execute successful stacks.

See how ShutterCoach evaluates focus stacking in your photos

Get instant AI feedback on your photography, including detailed analysis of technical.

Download ShutterCoach