Nodes/ComfyUI-LZNodes/LZ Batch Save With Labels
ComfyUI Node

LZ Batch Save With Labels

Batch-save XY plot grids with the labels baked into every filename

By liz-ils·Created 7 months ago·Updated 12 days ago· 1
LZ Batch Save With Labels
  • images
  • lz_pipe
    filename_prefixComfyUI
    x_labels
    y_labels
    image_formatpng
    save_txt_logtrue
    add_timestampfalse

    If you've ever run a grid of variations and then spent an hour matching outputs back to the settings that made them, LZ Batch Save With Labels is aimed at you. It's the save-node half of the pack's XY plot story: it takes a batch of images plus your X and Y label lists, saves each image with its label pair baked into the filename and metadata, and writes a batch log. You never have to guess which corner was CFG 7 again.

    How it works

    Two required inputs: images (the batch tensor from your sampler or grid node) and filename_prefix. The optional controls are where the magic lives:

    • x_labels / y_labels - multiline strings, one label per line (commas split too). The node parses them into lists and pairs image i with x_labels[i % len(x)] and y_labels[i // len(x)] - i.e., it assumes row-major grid order, which is exactly how the pack's XY plot nodes emit batches. If you supply no labels, it falls back to zero-padded indices.
    • image_format - png, webp, or jpg.
    • save_txt_log - also writes a text log describing the batch.
    • add_timestamp - append a timestamp to filenames so repeated runs don't collide.
    • lz_pipe - optional; the pipe's metadata (checkpoint, prompts, params) gets folded into the log and PNG metadata so the batch records what generated it, not just the labels.

    Filenames come out shaped like prefix_xlabel_ylabel.png, the workflow and pipe data ride along in the PNG's metadata chunks (the same mechanism ComfyUI uses to embed the graph in every save), and the node is marked as an output node so nothing further is required.

    Why you'd reach for it

    The pack ships a whole XY plot system (LZXYPlot family) for grid comparisons of checkpoints, LoRAs, samplers, and prompts. This node is the natural endpoint for those runs: the batch arrives already ordered, the labels tell you exactly what each cell was, and the log gives you the full parameter set. It also works standalone - any batch of images with an ordering you understand can be labeled this way. Pair it with a CSV logger and every batch is both a picture grid and a searchable record.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/liz-ils/ComfyUI-LZNodes
    

    restart → MyCustomNodes/IO. ComfyUI Manager: ComfyUI-LZNodes. No extra dependencies - it uses PIL and numpy, both already present in any ComfyUI install.

    Where people get burned

    • Label count vs. batch size mismatch. Give it 3 x-labels and 5 y-labels for a 15-image batch and the math works; give it labels that don't tile the batch cleanly and it wraps around silently (i % len(x)). Wrong-looking filenames are almost always a label-list length error, not a bug.
    • Metadata lives in the format. PNG gets full workflow/metadata chunks; if you pick jpg, metadata support is thinner and some of the embedded info is lost. Pick png if the metadata matters to you.
    • add_timestamp default is off - if you batch-save repeatedly under one prefix, later runs overwrite earlier files. Turn it on when you're iterating.

    It's a quiet, well-made utility that pays for itself the first time you need to identify one cell of a 20-image grid. For XY-plot power users it's arguably the most useful node in the pack that doesn't say "Anima" in its name.

    CategoryMyCustomNodes/IO

    Inputs (8)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI
    x_labelsoptSTRING
    y_labelsoptSTRING
    lz_pipeoptLZ_PIPE
    image_formatoptCOMBOpng3 options: png, webp, jpg
    save_txt_logoptBOOLEANtrue
    add_timestampoptBOOLEANfalse

    Outputs (0)

    No outputs