Nodes/ComfyUI-lhyNodes/Save Image as Zip
ComfyUI Node

Save Image as Zip

Batching Your Outputs Into a Downloadable Archive

By lihaoyun6·Created 12 months ago·Updated 13 days ago· 20
Save Image as Zip
  • image
    filename_prefixComfyUI
    save_metadatatrue
    formatpng
    text

    ComfyUI's normal Save Image writes files into your output folder one at a time. That's fine until a batch run produces fifty images and you want them as one file to download, hand to a client, or send somewhere without fifty separate drags. Save Image as Zip (class SaveImageAsZip) is the pack's answer: it takes an image batch, optionally a matching set of text strings, and writes the whole thing into a single zip you can grab from the output folder.

    The setup is straightforward. Feed it image (an IMAGE tensor - the batch of frames you just rendered), set a filename_prefix (default ComfyUI), and it produces a zip with the images numbered 00000.png, 00001.png, and so on, in ComfyUI's standard output directory with the usual counter suffix. The zip lands alongside your normal saves, so it behaves like any other output.

    Three settings matter more than the rest:

    • format - png, jpg, or png+jpg. PNG keeps the full workflow metadata; JPG is smaller but, as the metadata docs hammer home, JPEG re-encoding strips the embedded workflow, which is why the node separately writes *_prompt.json files alongside JPGs so you don't lose the recipe entirely.
    • save_metadata (boolean, default true) - whether to embed the workflow/prompt into each PNG's text chunks. If you're sharing these, leave it on; it's the "drag the image back in and get the graph" property people rely on.
    • text (optional) - a string or list of strings. When provided, each image gets a matching 00000.txt beside it, which is great for captioning a batch or stashing per-image prompts in the same archive.

    The inputs and outputs

    Required: image, filename_prefix, save_metadata, format. Optional: text. It's an output node with no outputs - it writes the file and shows the zip's name in the UI.

    One honest quirk: if you provide text, the node requires the text list to have the same length as the image batch - it errors out on a mismatch. That's a feature (it prevents misaligned captions) and a trap (forget to pad your list and the whole save fails). Also note it's list-aware under the hood, so if you're feeding it from a list-based batch, keep the lengths aligned.

    Where it fits

    This is the natural bookend to the pack's Load Image from Zip - upload a zip, generate, save a zip. For delivering a finished batch - a set of variations, a caption-plus-image dataset, frames for a video pass - it's the difference between a folder of loose files and one clean archive. And because the PNGs carry their workflow metadata, a zip of these images is a portable, self-documenting deliverable.

    Installing it

    Part of lhaoyun6/ComfyUI-lhyNodes. Install via ComfyUI Manager by searching for lhyNodes, or:

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

    Restart ComfyUI after. The pack's shared requirements are ultralytics, opencv-python, numpy, and yarl; this node needs only the standard library plus the pack install, and downloads no models.

    If you're forever zipping output folders by hand after batch runs, this node kills the chore at the source. Just remember the metadata toggle is doing real work - flip it off only when you genuinely don't want the workflow riding along.

    CategorylhyNodes/File

    Inputs (5)

    NameTypeDefaultDescription
    imageIMAGE
    filename_prefixSTRINGComfyUI
    save_metadataBOOLEANtrue
    formatCOMBOpng3 options: png, jpg, png+jpg
    textoptSTRING

    Outputs (0)

    No outputs