Nodes/ComfyUI Fast Preview/Fast Preview & Optimize
ComfyUI Node

Fast Preview & Optimize

The preview node that shows you what your image actually weighs

By AabhasTech·Created 4 months ago·Updated 3 months ago· 1
Fast Preview & Optimize
  • images
    image_formatwebp
    quality80

    Core ComfyUI's Preview Image writes a lossless PNG to the temp folder every single run. That's fine when you're just looking at the screen. It's genuinely annoying when the image is leaving your machine - over the ComfyUI API, or to a cloud workflow runner (the "Flow Worker"-style APIs this pack's README mentions) where the response payload and your bandwidth both scale with file size. That's the problem Fast Preview & Optimize exists to fix: same behavior as the stock preview node, but it re-encodes your image to WebP, JPEG, or PNG at a quality you choose, and then tells you the resulting file size right on the node. The name is a little grand, but it does what it says.

    How it works

    Under the hood it's refreshingly boring - which is a compliment. The node takes the image tensor, converts it to a PIL image, and saves it into ComfyUI's temp directory with a random 8-character filename prefix, exactly like the core preview node. The clever parts are the compression choices and the size readout.

    WebP saves use method=2, which favors conversion speed over squeezing out the last byte - the README's "fast conversion" in practice. JPEG saves use optimize=True. PNG is where you should pay attention: the quality slider is remapped to zlib compress_level, so quality 100 means no compression - a giant file - and a low slider means max compression. "Quality" for PNG here is really "how hard to compress," not perceptual quality.

    Then a small web extension listens for the node's file_sizes payload and injects a read-only widget showing something like Size: 186.42 KB. It only appears after the first run - there's nothing to measure before you've generated.

    The inputs that matter

    • images - the IMAGE tensor from your sampler, VAE decode, or upscale.
    • image_format - webp (default), jpeg, or png. WebP is the sensible default for previews: good quality, small file. Pick JPEG if something downstream insists on JPEG.
    • quality - integer 1–100, default 80. Fine-tune per format as above; for WebP, 80–90 is the sweet spot and 100 trends toward lossless-and-huge.

    One more real-world gotcha: JPEG has no alpha channel, so the node converts RGBA images to RGB before saving - your transparency quietly disappears if you choose JPEG.

    Installing it

    The README says ComfyUI Manager support is "Coming Soon," which is polite for not yet - you won't find this in Manager's search today. The real install is the manual one:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AabhasTech/ComfyUI_Fast_Preview.git
    

    Restart ComfyUI and grab it from the image category. The pleasant surprise: there's no requirements.txt at all. It only needs PIL and numpy, which ComfyUI already ships, and there are no model files to download. This is a zero-dependency pack, which is more than most of the ecosystem can say - a nice change after the usual dependency-hell install dance.

    Issues to expect

    Nothing here is a mystery failure, but a few things will trip you up. The size widget is invisible until you've run the prompt once - don't go hunting for a config box. The temp folder is volatile, so those fast_preview_*.webp files get cleaned up on restart; that's the point (no disk bloat), but it also means don't use this node when you need a persistent artifact - that's what Save Image is for. And if you set PNG quality to 100 expecting the prettiest file, you'll instead get a near-uncompressed PNG that's probably bigger than the original. For quick previews and API payloads, leave it on WebP at 80 and let the size widget do its job.

    Categoryimage

    Inputs (3)

    NameTypeDefaultDescription
    imagesIMAGE
    image_formatCOMBOwebp3 options: webp, jpeg, png
    qualityINT801–100

    Outputs (0)

    No outputs