Nodes/KJNodes for ComfyUI/Fast Preview Batch
ComfyUI Node Runs on cloud

Fast Preview Batch

Preview a huge image batch without the lag

By kijai·Created 3 years ago·Updated 2 days ago· 3,011
Fast Preview Batch
  • input
    max_thumb_size512
    crf25
    max_grid_frames1024

    Try to preview a few hundred frames, a video batch, a big seed sweep, with the normal Preview Image node and you feel it: ComfyUI grinds while it writes out that many PNGs and the browser chokes rendering them all. FastPreviewBatch sidesteps the whole mess. Instead of materializing N separate images, it encodes the batch as one tiny H.264 video and shows it to you as an interactive thumbnail grid.

    It's an experimental node in kijai's KJNodes, and "experimental" is fair, it's a clever hack more than a stable fixture, but for eyeballing large batches it's genuinely faster than the default.

    How it works

    The batch gets encoded into an all-intra-frame (all-I-frame) H.264 MP4, essentially a strip of thumbnails packed into a video container, which is dramatically cheaper than writing hundreds of PNGs to disk and shipping them to the browser. That MP4 renders as a clickable grid of tiles. Click a tile to enlarge it, then page through with prev/next. The "all I-frame" detail matters: every frame is independently decodable, so jumping to any tile is instant, no seeking through a GOP.

    The payoff is right there in the design: it avoids creating N PNGs. For a big batch that's the difference between a snappy preview and watching a spinner.

    The inputs and outputs that matter

    • input - the image or mask batch to preview. It takes both types.
    • max_thumb_size (default 512, range 512–1024) - the size of each thumbnail. Bigger tiles look nicer but cost more to encode; leave it at 512 for large batches.
    • crf (default 25, range 0–51) - the H.264 quality knob. Lower is higher quality and bigger; higher is more compressed and smaller. 25 is a sensible middle for a preview (this isn't your final output, so you don't need it pristine). Push it higher if the encode feels slow.
    • max_grid_frames (default 1024) - a cap on how many frames go into the grid, so an enormous batch doesn't try to build an unwieldy wall of tiles.

    It's a display node: no outputs. It shows the grid and that's the end of the branch. It is not a way to save an MP4, that's what a video-combine node is for.

    Installing it

    You probably have KJNodes already. If not: ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-KJNodes
    pip install -r ComfyUI-KJNodes/requirements.txt
    

    Restart ComfyUI. Because it encodes H.264, it leans on the video encoder in your environment; on most installs that's already present, but a bare setup missing ffmpeg-style support is the thing to check if encoding fails.

    Common issues

    The grid won't render / encoding fails. This node relies on H.264 encoding being available in your environment. If the preview never appears, that's the first suspect, confirm your ComfyUI can actually encode video (the same capability video-combine nodes need).

    It's an experimental node and behaves like one. It's filed under KJNodes/experimental for a reason, expect the occasional rough edge, and don't build a production pipeline around its output. It's a viewer, not a deliverable.

    Thumbnails look soft. That's crf and max_thumb_size trading quality for speed. Lower the crf and raise max_thumb_size if you need a sharper look, but remember this is meant to be a fast preview, not final quality.

    CategoryKJNodes/experimental

    Inputs (4)

    NameTypeDefaultDescription
    inputIMAGE,MASKImage or mask batch to preview.
    max_thumb_sizeINT512512–1024Detail-view (mp4) thumbnail max side. Strip thumbs for the grid are auto-capped at 256.
    crfINT250–51H.264 CRF. Lower = higher quality / larger file.
    max_grid_framesINT10241–4096If batch exceeds this, frames are stride-sampled evenly.

    Outputs (0)

    No outputs