Nodes/ComfyUI_Lam/图片克隆
ComfyUI Node

图片克隆

Need more frames? ImageClone duplicates your batch, on purpose

By yanlang0123·Created 2 years ago·Updated 11 days ago· 77
图片克隆
  • images
  • IMAGE
clone_multiple2

ImageClone (图片克隆, "image clone") is one of those nodes that looks pointless for a minute and then saves you in batch workflows. It takes your IMAGE tensor and repeats each frame clone_multiple times. One image in, clone_multiple = 3 means three identical frames out.

Why would you want that? Batch arithmetic. ComfyUI's sampler couples the latent batch size to the conditioning batch - if you want to sample four latent frames, you need four prompts in a batch, four noise latents, and so on. But sometimes your inputs don't line up that way. The classic case: you generated one base image and want to run the same image through several variations at once, or you have fewer images than you have prompts in a list, and you need the image side to catch up. ImageClone is the one-line fix - duplicate frames so the batch counts match, then let your batch system (or this pack's MultiTextEncodeAdvanced) pair them up.

It's also handy when a node further down the graph expects a minimum batch size. Some inpainting and face-detail utilities behave oddly with a batch of one; cloning to 2 or 4 sidesteps that without changing the actual content.

How it works

Nothing clever, and that's the point. The whole function body is a single tensor repeat on the batch axis:

images.repeat(images.size()[0] * clone_multiple, 1, 1, 1)

Every frame in the input batch gets duplicated clone_multiple times, preserving order: frames [A, B] with clone_multiple = 2 become [A, A, B, B]. The clone_multiple input defaults to 2 and has a floor of 2 - you can't set it to 1, because that would be a no-op and the author didn't see the point.

Inputs and output

  • images - any IMAGE tensor.
  • clone_multiple - how many copies of each frame to produce.
  • Output: IMAGE, the duplicated batch.

Install

In yanlang0123/ComfyUI_Lam - Manager search "ComfyUI_Lam", or:

cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam

restart. No models, no deps - pure torch. Skip the pack's install.bat entirely if you're only here for the image utilities.

Gotchas

Two things. First, memory: cloning a 4K batch of images 10× will happily balloon your VRAM or RAM when the frames hit a sampler or VAE decode - clones are real data, not references. Second, if you're feeding cloned frames into something that dedupes or hashes (like some save nodes), it'll save the same image N times under different filenames. That's usually what you want in a batch run, but if your output folder suddenly has four copies of everything, clone_multiple is why. Honestly, this is a "reach for it once a month" node - but when a batch count mismatch is blocking you, it's the fastest hammer in the drawer.

Categorylam

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
clone_multipleINT22–99999

Outputs (1)

NameTypeDescription
IMAGEIMAGE