Nodes/ComfyUI-SimpleChat/XY Cell Prefix (Batch)
ComfyUI Node

XY Cell Prefix (Batch)

Give every cell of your XY test its own filename

By Moeblack·Created 9 months ago·Updated 7 months ago· 8
XY Cell Prefix (Batch)
    • filename_prefix
    x_labels
    y_labels
    joiner+
    diagonal_singletrue
    base_prefix
    sanitizetrue
    matrix_modefull

    Run an XY sweep and you get a grid of images with no way to tell which file is which. XY Cell Prefix (Batch) fixes the least glamorous but most annoying part of batch testing: it builds a filename_prefix list, one entry per cell in the same row-major order as the pack's Anima XY Matrix and XY Plot (Labels), so each image saves under a name that says what it was. artist1+sunset street, artist1+night city, artist2+sunset street - you finally know which cell is which without opening every file.

    How it works

    You feed it the same two newline-separated label lists the XY matrix produces - x_labels and y_labels - and it cross-products them in row-major order (all X for the first Y, then the next Y, matching the image batch layout exactly). Optional bits:

    • joiner - default +, purely for the filename; doesn't touch your prompts.
    • diagonal_single - on the diagonal where x==y, use the single label instead of label+label.
    • base_prefix - a fixed prefix prepended to every cell (e.g. runs/v2_), handy for sorting in a folder.
    • sanitize (default on) - strips characters that aren't safe in filenames, collapses whitespace to _, and caps at 120 chars, because artist tags love slashes and colons.
    • matrix_mode - full, upper_triangle, or diagonal_only, mirroring the matrix node so the count of prefixes always matches the count of images.

    The output is filename_prefix as a list (OUTPUT_IS_LIST), designed to plug straight into SaveImage.filename_prefix. When ComfyUI saves each image from a batch pipeline, it walks the list, so cell N gets prefix N.

    Where it fits

    It sits at the tail of the pack's flagship sweep: Anima XY Matrix → per-cell JSON → sampler → XY Plot for viewing, and this node feeding SaveImage so the files on disk are identifiable too. Because it only makes strings, it costs nothing to run and never touches your images - pure metadata, no pixels harmed.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/Moeblack/ComfyUI-SimpleChat
    

    Restart, or use Manager and search "ComfyUI-SimpleChat". Only dependency: aiohttp.

    Gotchas

    The prefix list is built from the labels you give it, not from what the matrix actually generated - if your matrix_mode here doesn't match the one used upstream, the filename count and the image count diverge and you get mismatched names. Keep the two nodes in the same mode. Also, diagonal_single and matrix_mode assume square label lists; if len(x) != len(y) the non-full modes silently fall back to a full grid, so don't rely on triangle modes with unequal lists. And if a cell ends up with an empty label (blank lines are skipped), you get the literal fallback name cell - check your label lists for stray empties.

    CategorySimpleChat/Utils

    Inputs (7)

    NameTypeDefaultDescription
    x_labelsSTRING
    y_labelsSTRING
    joineroptSTRING+
    diagonal_singleoptBOOLEANtrue
    base_prefixoptSTRING
    sanitizeoptBOOLEANtrue
    matrix_modeoptCOMBOfull3 options: full, upper_triangle, diagonal_only

    Outputs (1)

    NameTypeDescription
    filename_prefixSTRING