What is focus stacking?

Focus stacking merges photos taken at different focus distances into one picture that is sharp from front to back. Each frame gets one slice of the subject sharp; the software lines the frames up and keeps the sharpest detail from each.

18 frames, each focused a little further back

A real bracket: 18 frames of a tiny mushroom with an insect on its stem. Cyan marks what each frame got sharp.

01 · Depth of field

Why can't one photo be sharp from front to back?

A lens focuses on one plane. Close up, the zone around it that still looks sharp, the depth of field, shrinks to a fraction of a millimetre. Here the log in front, the stem, the insect and the cap all sit at different distances, so no single frame holds them all.

Frame of the mushroom bracket with focus peaking marking its sharp band Frame 10 of 18

Focus step 10 of 18

Step through the bracket. Cyan is focus peaking: the band each frame got sharp. All is the stacked result, which keeps every band.
02 · Aperture and diffraction

Why not just stop down to f/22?

Closing the aperture deepens the sharp zone, but diffraction spreads every point of light into a blur spot that grows with the f-number. In macro it hits twice as hard, because the effective aperture grows with magnification. Stacking lets you shoot at the lens's sharpest aperture and get the depth from more frames.

Depth of field

0.32mm

Sharp zone against a 5 mm deep subject.

Diffraction blur

4.2px

Blur spot over the pixels of the 20 MP Micro Four Thirds sensor that shot this bracket.

At 100%

100% crop of the insect on the stem with the diffraction blur of the chosen aperture simulated

Simulated: the blur spot applied to a 100% crop.

Drag the aperture. Depth grows slowly while the blur spot grows fast: at 1:1 it is already three pixels wide by f/4. This bracket was shot at f/3.5.

Depth of field ≈ 2·N·c·(1+m)/m², with c = 0.01 mm (about 3 pixels). Blur spot = Airy disc diameter 2.44·λ·N·(1+m), λ = 0.55 µm, pixels 3.4 µm (OM System OM-1 Mark II). N is the f-number on the lens, m the magnification.

03 · Planning a bracket

How many photos does a focus stack need?

It depends on three things: magnification, aperture and subject depth. Each frame covers one depth of field, and neighbouring frames should overlap so no slice falls between them. Go from 1:1 to 2× and the frame count more than doubles.

Subject depth
Frames needed, with 20% overlap
Same depth-of-field formula as above. Real brackets add a few frames at each end so the nearest and farthest edges are covered.
04 · Focus breathing

What is focus breathing?

Most lenses change their field of view slightly as they focus, so the picture grows or shrinks from frame to frame. In this bracket the first frame is 0.9% larger than the last, and the subject moves about 80 pixels in the frame along the way. Stacked as shot, every edge would smear.

First frame of the bracket as shot Last frame of the bracket as shot Frame 1 · as shot

Watch the cap against the white lines.
Left: the first and last frame as shot, flicking between them. Right: the outline of all 18 frames as ReeStack measured them, drawn over the anchor frame (white). Highlighted: the frame on screen. Differences between outlines drawn 4× larger.
05 · Alignment

How are the frames of a focus stack aligned?

For every frame, ReeStack measures the shift, rotation and scale that put it exactly on top of one reference frame, the anchor, and moves it there on the GPU. That fixes breathing and a camera that creeps on its tripod. It doesn't correct perspective.

The bracket playing frame by frame as shot: the picture moves and swells As shot
The same frames aligned by ReeStack: the picture holds still Aligned

The whole bracket on a loop, as shot on the left and aligned on the right. As shot, the cap slides past the lines and the picture swells; aligned, it holds still and only the sharp band moves. The numbers are the transform ReeStack solved for each frame.

The fit is affine: six numbers per frame, solved with the ECC method from a small copy of the image up to finer ones. Precision sets how far it refines: Coarse (quarter resolution, the default), Balanced (half), Fine (full). Off stacks frames as shot, for rails and microscopes where nothing moves.

06 · Long brackets

Why don't long brackets drift out of alignment?

Alignment works by matching detail, and frames far apart in a bracket are sharp in different places. They share little to match on. So instead of aligning every frame to one reference, ReeStack moves its reference along the bracket every 8 frames: each frame is matched against one that looks like it.

Detail match with the anchor (frame 10)Detail match with the next frame

A 40-frame bracket, aligned by ReeStack

Top: how closely each frame's detail map matches the anchor's versus its neighbour's, measured on this bracket (1 = identical). The frames at the ends match the anchor only about half as well (0.46 and 0.54) but match their neighbours at 0.98 or better. Bottom: each arc is one alignment solve; the reference moves every 8 frames.

A frame whose solve jumps implausibly is left out of the chain, so one bad frame can't push its error into the frames after it.

07 · Crop and anchor

Why do focus stacks come out smaller than the frames?

Breathing and creep mean the frames don't cover exactly the same area, and a stack can only keep the area every frame covers. When a bracket breathes 1% or more from end to end, ReeStack anchors on its most zoomed-in end, so no frame's detail is shrunk away. This one breathes 0.9%, so ReeStack kept the middle frame.

Anchor

The 18 measured frame outlines, seen from each anchor (white). Dashed: the area every frame covers, which the result keeps. Outlines are drawn 4× further apart than they are, so the differences show.

Here both anchors keep 19.4 MP: most of the trim comes from the subject moving about 80 pixels, which no choice of anchor wins back. On a bracket that breathes more, the zoomed-in end keeps visibly more.

08 · Resampling

Does aligning the frames soften them?

It can. A moved frame lands between pixels, so every pixel has to be recalculated from its neighbours. The simple way, bilinear, averages them and softens every frame a little. ReeStack resamples with a bicubic (Catmull-Rom) filter, which keeps much more of the fine detail.

Crop of the insect resampled with a bilinear filter, at 300%: softer fine detail Bilinear
The same crop resampled with ReeStack's bicubic filter, at 300%: sharper fine detail Bicubic · ReeStack

Same crop, 300%

Bilinear63%
Bicubic (ReeStack)83%

Fine detail kept after one move, measured as high-frequency energy against the original.

A 100% crop of the stack shown at 300%, moved once by frame 1's measured transform plus half a pixel, then resampled two ways. Look at the thin legs and the edges of the body. Every frame but the anchor goes through this once.

Try it on your own brackets.

ReeStack finds your brackets, aligns and stacks them, and lets you paint any leftover flaw away from the source frames.