Nodes/ComfyUI-K3NKImageGrab/K3NK Save & Compress πŸ—œοΈ
ComfyUI Node

K3NK Save & Compress πŸ—œοΈ

Save Images 60% Smaller and Still Drag Them Straight Back Into ComfyUI

By K3NK3Β·Created 9 months agoΒ·Updated 2 months agoΒ· 8
K3NK Save & Compress πŸ—œοΈ
  • images
    β—„filename_prefixk3nk/imageβ–Ί
    β—„formatβ–Ύβ–Ί
    β—„compression_modeβ–Ύβ–Ί
    β—„quality_min85β–Ί
    β—„quality_max100β–Ί
    β—„pngquant_speedβ–Ύβ–Ί
    β—„oxipng_level2β–Ί
    β—„lossy_quality90β–Ί

    ComfyUI's normal save node has a dirty secret: PNGs coming off a diffusion model are fat. A typical Flux image saves at 2–4 MB, and when you're shipping a batch to a gallery, a Discord, or a client, that's a lot of dead weight. K3NK Save & Compress πŸ—œοΈ is a drop-in image saver that runs TinyPNG-style compression on the way out - and here's the part most compressors get wrong: it keeps the workflow metadata intact, so the saved file still drags back into ComfyUI and reconstructs your whole graph.

    That metadata trick is the differentiator. Plenty of tools will shrink your PNG, but they strip the embedded prompt/workflow chunks in the process, and you lose the "post the image, share the workflow" culture ComfyUI is built around. This node extracts the text chunks before compressing and re-injects them after, because pngquant and oxipng would happily delete them.

    How it works

    Two well-known open-source tools do the work, and the node auto-downloads their binaries from GitHub Releases on first use - no manual install:

    • oxipng (MIT) - lossless PNG recompression, the safe baseline.
    • pngquant (GPL v3, by Kornel LesiΕ„ski) - lossy quantizer that reduces the color palette; this is where the big size drops come from.

    The README's numbers for typical Flux images are worth believing: lossless oxipng gets you ~5–10% smaller, pixel-perfect; adding pngquant on top lands ~50–70% smaller while looking identical. For a batch of render outputs, that's the difference between a 100 MB upload and a 40 MB one.

    Pick a compression_mode: none (baseline save), lossless (oxipng), or lossy+lossless (pngquant+oxipng). The quality knobs are quality_min/quality_max (pngquant's allowed quality range, default 85–100) and pngquant_speed (1 = slowest/best, 10 = fastest). oxipng_level 1–6 trades time for compression. For WEBP/JPEG output, lossy_quality (default 90) applies instead.

    The inputs that matter

    • images - the batch to save.
    • filename_prefix - default k3nk/image; subfolders work, and it supports %date:format% tokens (e.g. %date:yyyy-MM-dd%) so you can auto-organize by day.
    • format - PNG, WEBP, or JPEG. WEBP/JPEG are inherently lossy and ignore the pngquant/oxipng modes.
    • compression_mode - see above. Start with lossless (oxipng) if you're nervous; the lossy+lossless tier is where the dramatic savings live.

    It's an output node - no image outputs, it just writes files and reports them to the UI.

    Installing it

    ComfyUI Manager β†’ search ComfyUI-K3NKImageGrab, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/K3NK3/ComfyUI-K3NKImageGrab
    

    Restart, and the first PNG save will pull the binaries down into the node's bin/ folder (needs internet once). If the download fails, it degrades gracefully to uncompressed output and logs a message.

    Where people get burned

    The main one is expecting compression and pixel-perfect fidelity at the pngquant tier - you can't have both; that's what lossy means. Keep quality_min high (85 is a sane floor) and you won't see the difference, but on flat-color or text-heavy images pngquant can band visibly, and the node can't warn you.

    Also: the license notice is real, not cosmetic. pngquant is GPL v3, so think twice before distributing a build that bundles these binaries inside a proprietary product - the README explicitly disclaims authorship of the binaries, but that doesn't make the GPL go away for redistributors. For personal and most workflow-sharing use it's a non-issue.

    CategoryK3NK/IO

    Inputs (9)

    NameTypeDefaultDescription
    imagesIMAGEβ€”
    filename_prefixSTRINGk3nk/imageβ€”
    formatCOMBO3 options: PNG, WEBP, JPEG
    compression_modeCOMBO3 options: none, lossless (oxipng), lossy+lossless (pngquant+oxipng)
    quality_minINT850–100β€”
    quality_maxINT1000–100β€”
    pngquant_speedCOMBO4 options: 1 (slowest/best), 3 (balanced), 6 (fast), 10 (fastest)
    oxipng_levelINT21–6β€”
    lossy_qualityINT901–100β€”

    Outputs (0)

    No outputs