Nodes/ComfyUI_Swwan/Fast Preview (Swwan)
ComfyUI Node

Fast Preview (Swwan)

Base64 previews so you stop filling your temp folder

By aining2022·Created 10 months ago·Updated about 18 hours ago· 33
Fast Preview (Swwan)
  • image
    ◄formatJPEG►
    ◄quality75►

    What it is

    Fast Preview shows you an image without writing it to disk. It encodes the frame in memory as JPEG/PNG/WebP, base64s it, and hands the string to a small frontend script that displays it on the node. No temp file, no output file, no PNG chunk with your workflow baked in. The node's own description calls it experimental, and it's KJNodes' FastPreview re-registered by the Swwan pack.

    Why care? Every core Preview Image writes a real PNG to ComfyUI/temp, and if you're iterating on a video or running a loop, that folder becomes thousands of files you'll never look at. If you're on a laptop, a network share, or anything where disk writes are the slow part, a memory-only preview is a genuine speedup for the check-it-and-move-on loop.

    The trade is real, though, and it's the same trade as everything in ComfyUI's metadata culture: no file means no embedded workflow, no seed, no provenance, nothing to drag back into the canvas. The file is the project file here. Use Fast Preview while you're working, Save Image when the result matters.

    How it works

    The node takes image, converts the first frame to a PIL image via torchvision, saves it into an in-memory buffer in the format you picked, base64-encodes the bytes, and returns them as bg_image on the UI payload. A JS extension shipped with the pack (web/js/swwan_preview.js) hooks the node's onExecuted and swaps the result straight into the node's on-canvas image, sniffing the format from the base64 prefix. There's a reason it can be fast: nothing touches the filesystem.

    It only previews image[0]. One frame, always the first. A 96-frame batch renders one thumbnail and you get no clue that anything else exists. If you need to see a specific frame, slice it out first - the pack's Get Image Range From Batch is right there, or Get Images From Batch Indexed.

    Inputs

    • image - required IMAGE.
    • format - JPEG (default), PNG, WEBP.
    • quality - 1 to 100, default 75. Only affects the lossy formats; PNG ignores it. At low quality you're previewing compression artefacts, not your render, so don't judge fine detail at 40.

    That's the whole node. It has no outputs - it's an output node, so it's a terminal in the graph like Save Image, and you can't chain off it.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/aining2022/ComfyUI_Swwan
    cd ComfyUI_Swwan
    python -m pip install -r requirements.txt
    

    Manager → ComfyUI Swwan. Restart ComfyUI, then hard-refresh the browser - the display half of this node lives in the pack's frontend JS, so a cached page can leave you with a node that runs and shows nothing. If the node appears to do nothing on execute, that's the first thing to check: open devtools, look for /extensions/ComfyUI_Swwan/swwan_preview.js loading, and force-reload if it isn't.

    The dependency most people miss

    The node imports torchvision.transforms.functional.to_pil_image at call time. torchvision is deliberately not in the pack's requirements.txt - the README's rule is that the pack uses the torch/torchvision that your ComfyUI environment already has, because installing a mismatched pair is how you break ComfyUI itself. Nearly every install has both, so in practice you'll never notice. But if you're on a stripped-down or CPU-only build, Fast Preview is the node that will throw the missing-import error while everything else in the pack keeps working.

    Gotchas worth knowing

    It won't appear in the output folder or the ComfyUI image gallery, because it never existed as a file. Anything downstream that scans the output directory for "what did I generate?" sees nothing.

    WebP and JPEG are lossy at the quality you set, so a preview can look worse than the saved PNG sitting next to it from a different branch of the same graph. Don't tune a fine-detail pass off a 75-quality JPEG.

    And it's a leaf node: no outputs means no wiring, which also means it's a bad place to put a "check the value here" probe in a long chain. For that you want a node with a pass-through output. This one is for looking at things, and it's good at exactly that.

    CategorySwwan/Advanced/IO

    Inputs (3)

    NameTypeDefaultDescription
    imageIMAGE—
    formatCOMBOJPEG3 options: JPEG, PNG, WEBP
    qualityINT751–100—

    Outputs (0)

    No outputs