MacroStack
Free and open source · Android

Focus stacking, shot and merged on your phone

One fast burst of photos, one photo sharp from front to back. Made on your phone.

Version 2.1 · Android 10 or newer · GPL-3.0

The stacked result: the wooden beads in front, the engraving on the coin and the lace behind it are all sharp. A single frame: only the wooden beads in front are sharp; the coin and the lace are blurred.
One frame Stacked: 20 frames

Drag to compare. Shot and stacked on a Galaxy S24 Ultra by Bakkori.

How it works

Frame 1: the beads in front are sharp1
Frame 6: the coin is sharp6
Frame 11: the lace just behind the coin is sharp11
Frame 15: the lace further back is sharp15
Frame 20: the lace at the back is sharp, the coin is blurred20
1Shoot20 photos in one burst, focus stepping from front to back.
The depth map: the beads and coin light (near), the lace behind darker (far)
2Align & mapFrames lined up, then a map of what's sharp where.
The stacked photo: beads, coin and lace all sharp
3StackThe sharp parts become one photo.
21 fps burst JPEG or RAW Stacks on the phone Keep shooting while it stacks Depth map · cleanest Pyramid · finest hairs

Tested in the open

Every version is checked against two popular free desktop stackers, focus-stack and Shine Stacker, on the same 17 stacks.

0–2%made-up detail
0.06 pxalignment error, hand-held
21 fpsburst, Galaxy S24 Ultra

Made-up detail

Halos, blotches and noise that are in none of your photos. Worst case across 17 stacks; lower is better.

MacroStack
2%
Shine Stacker
37%
focus-stack
50%
focus-stack: the needle's eye, with a grainy background
focus-stack 1.5sharpens the background grain too
Shine Stacker: the needle's eye, with a grainy background
Shine Stacker 1.17sharpens the background grain too
MacroStack Pyramid: the needle's eye, with a smoother background
MacroStack Pyramidwhat the phone made
MacroStack Depth map: the needle's eye, with the smoothest background
MacroStack Depth mapthe smoothest background

A needle's eye from another of these stacks, enlarged. All four are sharp; only MacroStack keeps the blurred background smooth.

See all the numbers
Each cell: soft (% of detailed areas less than 70% as sharp as the sharpest frame) and, below it, made-up (% of the picture with detail that's in none of the frames: halos, blotches, noise). Lower is better for both. Highlighted: made-up detail over 5%. Desktop stackers ran with their default settings.
Test stack MacroStack
Depth map
MacroStack
Pyramid
focus-stack
1.5
Shine Stacker
Pyramid
Shine Stacker
Depth map
Circuit-board switch, 10 frames, big focus steps2.00.32.70.35.117.346.9*2.949.1*1.0
Circuit-board pins, 7 frames3.50.67.10.33.326.80.42.01.30.7
Plants, hand-held phone, 23 frames0.70.12.40.41.45.00.02.41.40.1
Fruits, hand-held phone, 30 frames6.90.00.00.00.02.31.12.84.30.5
Keyboard, hand-held phone, 32 frames6.40.01.20.00.61.62.32.59.70.6
Galaxy S24 Ultra stack, 20 frames10.70.00.30.10.013.40.514.12.54.5
Pro macro, Canon R5 II, 50 frames26.10.017.80.224.450.098.9*0.098.9*0.0

The table shows the first 7 test stacks. On the 10 studio stacks shot with MacroStack on a Galaxy S24 Ultra, made-up detail was 0–2% for MacroStack, 16–41% for focus-stack and 1–37% for Shine Stacker; their softness isn't listed, because on phone JPEGs the score counts grain as detail. Since version 2.1 the Pyramid adds no dark specks or rims along edges; the score counted some of those as detail, so its softness numbers rose slightly. * Shine Stacker's alignment skipped frames it couldn't match on these stacks (4 of 10 and 48 of 50), so its results there lack detail. Hand-held phone sweeps: Depth from Focus with Your Mobile Phone (Suwajanakorn, Hernández and Seitz, CVPR 2015). Pro macro: every 20th frame of a 999-frame stack by Johannes Sood (CC BY 4.0).

Where the others do better

focus-stack keeps the most fine texture: its wavelet merge lifts contrast beyond any single frame, which is also where its made-up detail comes from. Where Shine Stacker aligned every frame, its pyramid kept more fine contrast than ours, and its depth map was sharper on the phone stack. MacroStack's Depth map trades a little fine texture for less noise. Closing those gaps is what the next versions work on, with your stacks. Read the engine log.

Help make it better

Every stack you share makes the engine better.

Any camera or phone
10–50 original frames
Tricky subjects: hairs, shine, motion
Credited by name

Used only for testing. Shown publicly only if you say so.

Email a Google Drive, Dropbox or WeTransfer link to the frames: abubaker.elsultani at gmail.com · Report a problem

Credits

Made by
Bakkori, a macro photographer, with the help of Claude (Anthropic).
Stacks shared by photographers
Your name could be first here.
Test stacks
Petteri Aimonen (focus-stack examples, MIT) · Johannes Sood (Canon R5 II macro stack, CC BY 4.0) · Supasorn Suwajanakorn, Carlos Hernández and Steven M. Seitz (phone focus sweeps, CVPR 2015)
Compared against
focus-stack by Petteri Aimonen · Shine Stacker by Luca Lista