Nodes/comfyUI_LLM/➕ 追加图片到Batch
ComfyUI Node

➕ 追加图片到Batch

Splice one image batch onto another, in the order you want

By XieJunchen·Created about a year ago·Updated about a month ago· 2
➕ 追加图片到Batch
  • image_batch
  • images_to_add
  • image_batch

In ComfyUI, an IMAGE isn't one picture - it's a batch, a stack of pictures with a batch dimension out front. Most of the time the nodes handle that silently. Every now and then you need to combine two stacks by hand: prepend a first-frame to a video you just generated, append a caption card to a frame sequence, or build up a batch across a loop. That's this node - "➕ 追加图片到Batch", one input batch, one batch to add, one combined batch out.

How it works

It's torch.cat along the batch axis, with two guard rails. If the incoming image_batch is empty (the (0,0,0,0) shape that CreateEmptyImageBatch produces), it just returns images_to_add as the new batch - so you can chain appends starting from nothing. Single 3D images (H,W,C) get promoted to 4D before the concat, so wiring one image into it doesn't crash.

Inputs and output

  • image_batch (IMAGE) - the stack you're appending to.
  • images_to_add (IMAGE) - the stack (or single image) you're adding.
  • Output image_batch (IMAGE) - the merged result, in the order batch-then-added.

The trap that catches everyone

The concat has to line up. Every dimension except the batch one must match - height, width, and channels all have to agree between the two inputs. Append a 512×512 batch to a 768×768 one and you get a raw torch.cat error in the console. ComfyUI's own "batch" nodes don't always warn you about this either, so if you hit a size-mismatch error, the fix is to resize one side first. The node doesn't check, it just fails loudly.

Also worth knowing: nothing is resampled, no alpha gets flattened, no blending happens. This is a dumb, honest append - which is exactly why it's useful as a building block.

Installing it

Standard for the pack - ComfyUI Manager → search comfyUI_LLM, or:

cd ComfyUI/custom_nodes
git clone https://github.com/XieJunchen/comfyUI_LLM
# restart ComfyUI

Pure torch, no extra dependencies beyond what the pack installs.

Where you'll actually use it

The realistic pairing is with this pack's GetFirstImageFromBatch / RemoveFirstOrLastImageFromBatch: pull the first frame out, tweak it, append it back. Or the classic: after SplitVideoByFrames splits a video into clip-sized batches, you might re-append a short clip's frames onto a sequence you're feeding to an image-to-video model. It's a five-line utility dressed as a node - but in a graph editor, five lines you can wire beats five lines you have to script.

Category云服务/集合工具

Inputs (2)

NameTypeDefaultDescription
image_batchIMAGE
images_to_addIMAGE

Outputs (1)

NameTypeDescription
image_batchIMAGE