Nodes/ComfyUI-BFSNodes/Sharpest Frame / Laplacian (BFS)
ComfyUI Node

Sharpest Frame / Laplacian (BFS)

H3's best frame isn't a fixed index — let Laplacian find it

By alisson-anjos·Created 5 months ago·Updated about 21 hours ago· 105
Sharpest Frame / Laplacian (BFS)
  • images
  • image
  • index
  • scores
skip_first0

When you use MiniMax-H3 as an image generator - or grab a still from a short static clip - the minimal VAE clip (5 frames from 2 latent steps) decodes with uneven sharpness, and the crispest frame isn't always the same index. SharpestFrame scores every frame by Laplacian variance and hands you the winner, plus the index and the raw scores. The technique comes straight from IF-Edit (arXiv:2511.19435), where decoded frames carry different amounts of residual blur, and scoring beats guessing a fixed index.

Here's the honest part, because the node's own source says it plainly: this is a blur heuristic, not a quality metric. Laplacian variance measures high-frequency energy, and artifacts are high-frequency too. In the author's own measurement on an H3 decode, the scorer picked the frame with the worst PSNR (19.72 dB vs 23.19 for its neighbor) because it was the most artifacted. So the rule of use matters:

  • Do use it when the candidates are the same content differing only in blur - the static H3 clip and IF-Edit cases.
  • Don't use it to choose between frames from different moments. It has no notion of composition, faces, or content; it only knows energy.

Inputs are light:

  • images - the batch of frames, same content. That's the whole contract.
  • skip_first - default 0; ignores the first N frames before scoring. H3's decoded blocks often open with temporal padding, so bump this when the lead frames are junk.

Outputs:

  • image - the winning frame as a 1-frame batch, ready for Save Image or any image node.
  • index - the integer position of the winner. Wire it into anything that wants to know which frame won.
  • scores - a string with each frame's Laplacian value and a marker on the winner; handy for a Text display node. The console logs the same line, so you get it either way.

Installing it

Part of the ComfyUI-BFSNodes pack - ComfyUI Manager (search ComfyUI-BFSNodes) or:

cd ComfyUI/custom_nodes
git clone https://github.com/alisson-anjos/ComfyUI-BFSNodes.git
cd ComfyUI-BFSNodes
pip install -r requirements.txt

Restart and it shows up under BFS/image.

Common issues

The trap isn't installation, it's misuse: feed it frames of different moments and it'll cheerfully pick the "sharpest" - which is often just the most artifacted. The skip_first knob exists because H3's temporal padding frames score oddly; if you're picking a frame that's obviously wrong, that's the first thing to raise. And if you expected a quality picker that understands faces or composition, set expectations: this is a one-line heuristic wearing a utility belt, and it's good precisely because it's honest about that.

CategoryBFS/image

Inputs (2)

NameTypeDefaultDescription
imagesIMAGELote de frames que sejam o MESMO conteudo diferindo em borrao (ex.: clipe estatico do H3 em modo imagem). Para frames de momentos diferentes isso nao faz sentido.
skip_firstoptINT00–64Ignora os N primeiros frames antes de pontuar. No H3 os primeiros frames de cada bloco decodificado costumam ser preenchimento temporal.

Outputs (3)

NameTypeDescription
imageIMAGE
indexINT
scoresSTRING