ComfyUI Node

Image Merger

Image Merger — put before and after side by side so you can actually see what changed

By komojini·Created 3 years ago·Updated 2 years ago· 77
Image Merger
  • images_1
  • images_2
  • images
  • num_images
divide_points(50%, 0);(50%, 100%)
line_thickness0

Image Merger stacks two images (or two batches of frames) side by side in a single canvas, split along a line you define. Its stated purpose is the best reason to use it: "Useful to see the results of img2img or vid2vid." When you're iterating on an img2img pass or a video frame pair, the fastest way to tell whether the output actually improved is to look at input and output in one frame - and this node does exactly that, down to rendering both videos as a single comparison clip.

How it works. The merge is a straight geometric split, not a blend. The two point inputs define a line across the canvas, and everything on one side of the line comes from images_1 while everything on the other side comes from images_2. The implementation builds a per-pixel mask from the line equation and composites the two tensors against it. Optionally, line_thickness paints the dividing line itself (as a white band) so the seam is visible. If the two batches have different frame counts it'll use images_1's shape and index accordingly, so keep the batches matched.

The divide_points string is the one input worth getting right. It's two points separated by a semicolon, each in (x, y) form, where x/y can be absolute pixels or percentages. The README's examples are the fastest way in:

  • (50%, 0);(50%, 100%) - vertical split right down the middle
  • (0%, 50%);(100%, 50%) - horizontal split across the middle
  • (40%, 0);(70%, 100%) - a diagonal, with the first image taking the top-left

The default is the vertical center split. Only two points are supported - the code explicitly raises NotImplemented if you give it more, so don't try to build a three-region collage with this.

Inputs and outputs. images_1 and images_2 (IMAGE), divide_points (STRING), line_thickness (INT, default 0). Outputs are images (the merged IMAGE batch) and num_images (INT). Both inputs need to be the same resolution - the merge reads its canvas size from images_1, and any mismatch just crops the math to the first image's dimensions rather than erroring helpfully.

Where it fits and what bites. It's a compare node, so reach for it during iteration, not in your final render. The trap for beginners is feeding it mismatched resolutions or frame counts and getting a subtly off comparison; feed it the raw before/after pairs and you're fine. The split-line syntax is fiddly but the percentages make it forgiving. Since it's part of komojini-comfyui-nodes, install is the usual one-liner: Manager → search "komojini-comfyui-nodes" → Install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/komojini/komojini-comfyui-nodes. No models, no heavy deps beyond the pack's usual opencv/pytube requirements. For a plain side-by-side comparison there are heavier tools out there - this one is refreshingly single-purpose.

Categorykomojini/Image

Inputs (4)

NameTypeDefaultDescription
images_1IMAGE
images_2IMAGE
divide_pointsSTRING(50%, 0);(50%, 100%)
line_thicknessINT00–1000

Outputs (2)

NameTypeDescription
imagesIMAGE
num_imagesINT