Nodes/Remade_nodes/Batch Image Overlay
ComfyUI Node

Batch Image Overlay

Pasting one image on top of a whole batch, in the right order

By Pheat-AI·Created 2 years ago·Updated 2 years ago· 5
Batch Image Overlay
  • gen_images
  • original_image
  • IMAGE

Read the node name against its behavior and you'll be briefly confused, the way the author's own debug prints suggest everyone is. Batch Image Overlay takes a batch of generated images and a single original_image, and overlays that original on top of each generated image. The name reads like it pastes the batch over the original; the code does the reverse. It's Image.alpha_composite(gen, original) - original wins where it has any alpha.

So what is this for? It's a compositing helper for the inpainting-style workflow this pack clearly grew out of. You have a batch of candidate results (gen_images), and you have the untouched original photo you started from. You want the original back on top of every candidate - for example to lock in the un-edited parts while the generated content shows only where it's allowed to. One wire in, a whole batch out, no manual per-image compositing.

What it actually does

For every image in the batch it converts everything to RGBA, resizes the original to match that frame's dimensions (nearest-neighbor-free, it uses PIL's plain resize), then alpha-composites the original over the frame. Result frames are stacked back into one batch tensor. Because each generated frame gets the original resized to its size, the batch doesn't need to be uniform for this node to run.

Inputs and outputs

  • gen_images (IMAGE) - the batch, usually decoded latents or an earlier pass.
  • original_image (IMAGE) - the single image pasted on top of every frame.
  • Output: IMAGE, a batch of the same length.

The only output is a stack of composited frames - wire it into a SaveImage (or PreviewImage, or your video encoder of choice).

The gotchas

  • Order matters. If you meant "generated image on top of the original," swap the inputs: feed the generated image as original_image and the base as gen_images. Easy to do backwards, silent to do so.
  • It resizes the original to each frame. If your original is a big photo and your candidates are small crops, the overlay gets downscaled - composition shifts with resolution. Fine for locking in structure, wrong for precise alignment.
  • Alpha is respected. Where the original is fully opaque it fully covers the frame. If your original has holes, the generated content shows through them. That's usually what you want, but it surprises people expecting a flat paste.

Installing it

This is one of 12 nodes in the Remade_nodes pack, so install the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Pheat-AI/Remade_nodes

Restart ComfyUI, or search Remade_nodes in ComfyUI Manager and hit Install. There's no README and no model download; requirements.txt lists only numpy, though the pack's color-blend node imports OpenCV at load time, so if cv2 is missing from your environment the whole pack fails to import (pip install opencv-python sorts it).

It's a small node with a genuinely useful job once you internalize the argument order. Batch of candidates plus one reference image, and every frame comes out composited.

CategoryREMADE/Image

Inputs (2)

NameTypeDefaultDescription
gen_imagesIMAGE
original_imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE