Nodes/ComfyUI-ImageConcat/Image Concatenate Batch With Txt
ComfyUI Node

Image Concatenate Batch With Txt

This one builds LoRA datasets on disk

By BigWhiteFly·Created about a year ago·Updated about a year ago· 1
Image Concatenate Batch With Txt
    • STRING
    image_folder1
    image_folder2
    output_folder
    prompt_prefix
    prompt_subfix

    The name is doing double duty, and it'll cost you a couple of hours if you don't read this first. "Image Concatenate Batch With Txt" sounds like the node you'd drop into a Flux Kontext workflow to jam two reference images side by side. It is not that. It has no image inputs, no preview, and its single output is a string, not pixels. What it actually does is read every image in two folders, glue each pair together, merge the matching caption .txt files, and write the results to disk. It's a batch dataset-prep tool for LoRA training, and it never touches the graph.

    If you came here from a "how do I use two reference images" thread: that's the wrong tool, and the one person on Reddit who was pointed at this pack in 2025 got told exactly that - use a real per-image concat node instead. This thing is for building training data, full stop.

    What it's actually for

    LoRA quality lives or dies on the dataset. The training essay in our KB is blunt about it: curation beats every knob on the trainer, and captioning is one of the most impactful factors there is. This node is a shortcut for one specific dataset shape - teaching a model a relationship between two image sets. Say you want a character LoRA that also understands its usual environment. You keep a folder of character shots and a folder of background shots, and this node produces the cross-product: every character image glued onto every background, side by side, with a caption that names both halves. In the source that's the whole point - the README says it plainly: "This is for training loras."

    How it works

    There are exactly five inputs, all plain strings you type (no model files, no uploads):

    • image_folder1 and image_folder2 - the two source folders.
    • output_folder - where the merged set goes.
    • prompt_prefix / prompt_subfix - text baked into every merged caption, handy for a trigger word or a closing style tag.

    Under the hood it's a nested loop, so here's the trap: it's a cartesian product, not a pairwise match. Ten images in folder one and ten in folder two gives you 100 outputs; 100×100 gives you 10,000. Decide whether that's what you want before you click, because there's no progress bar and no cancel.

    For each pair it loads both images, resizes the second to match the first's height (aspect ratio preserved, lanczos), and stitches them side by side - the direction is hardcoded to right; you can't ask for top/bottom. The merged file is named img1_img2.png. Then it reads the two same-named caption files and writes img1_img2.txt as:

    <prompt_prefix>,<caption1>,<caption2>,<prompt_subfix>
    

    So your folders need sibling captions: char_001.png must sit next to char_001.txt, or you get the image with no caption and no warning.

    The one output

    You get a single STRING - the output folder path. That's it. Nothing to preview, nothing to wire downstream; it's fire-and-forget. Hook it to a Save Text node if you want visual confirmation it ran, or just ignore it and check the folder.

    Install

    Boring in the best way. No requirements.txt, no heavy dependencies - it only uses PIL, numpy, and torch, all of which ComfyUI already ships. Via Manager, search ComfyUI-ImageConcat, or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BigWhiteFly/ComfyUI-ImageConcat
    

    Restart ComfyUI. That's the whole install.

    Where people get burned

    • Folders that don't exist. The node just prints an error to the console and returns nothing - ComfyUI still says "executed successfully," so check the server log if nothing appears. Paths can be absolute or relative; relative ones resolve against your ComfyUI base directory.
    • Missing caption files. The image still gets written; the caption is silently skipped. You'll discover it when the trainer warns about image-less tags.
    • Mismatched sizes. Every output takes folder one's height, so a mixed-size folder one gives you a ragged output set. Fine for ai-toolkit's bucketing, mildly annoying if you wanted a clean uniform folder.
    • Empty prefix/subfix. Those commas in the format string still get written, so a blank prefix leaves a leading , in every caption. Harmless, but ugly.

    Is it overhyped? No - it's basically unknown (that single 2025 Reddit mention is about the only trace of it). It's a one-trick utility for a specific LoRA prep workflow. If you need that trick, it works and it's dependency-free; if you need anything else from a concat node, this isn't it.

    Categoryimage

    Inputs (5)

    NameTypeDefaultDescription
    image_folder1STRING
    image_folder2STRING
    output_folderSTRING
    prompt_prefixSTRING
    prompt_subfixSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING