Nodes/ComfyUI-WJNodes/Robust Imager Merge
ComfyUI Node

Robust Imager Merge

Stitch two images side by side without fighting mismatched sizes

By 807502278·Created 2 years ago·Updated 11 months ago· 21
Robust Imager Merge
  • image1
  • image2
  • mask1
  • mask2
  • image
  • mask
  • width
  • height
merge_directionright
auto_scaletrue
output_modemerge

Stock ComfyUI doesn't have a clean one-node way to just glue two images together side by side. You end up hand-rolling it with resize nodes to match dimensions, then a concat or composite, and if the two images are different sizes to start with, that's an extra step you have to remember every time. This node is the shortcut: give it two images, tell it which direction to stack them, and it handles the size mismatch for you.

It's from ComfyUI-WJNodes, a personal utility pack by an author who publishes only under the handle 807502278 - the kind of small, practical node that gets written the third time you find yourself building the same three-node combo manually.

What it does

Feed it up to two images (and, optionally, their masks) and pick a direction - right, left, up, or down - and it merges them along that axis. The auto_scale toggle, on by default, is what makes it "robust": rather than requiring the two inputs to already be the same height (for a left/right merge) or width (for an up/down merge), it resizes one to match the other automatically, so you don't need a separate resize step in your graph just to make two mismatched images stackable.

The output_mode setting adds a bit of flexibility beyond pure merging: leave it on merge for the combined result, or set it to input1 or input2 to pass just one of the two images straight through unmerged. That sounds like an odd option until you're using this node as a toggleable A/B switch in a larger graph - flip output_mode to compare "just the original" against "the merged comparison" without rewiring anything.

Inputs and outputs that matter

  • merge_direction - right, left, up, or down. Defaults to right.
  • auto_scale - on by default; resizes the mismatched input to fit rather than erroring or clipping.
  • output_mode - merge, input1, or input2.
  • image1 / image2 (optional) - the two images to combine.
  • mask1 / mask2 (optional) - corresponding masks, merged the same way if supplied.

Outputs: image and mask (the merged result, or the passthrough if output_mode isn't set to merge), plus width and height for the final combined dimensions - handy for wiring straight into a save node's expected size or a downstream latent.

Where this actually gets used

The obvious case is building before/after or comparison images - stack a source and a result side by side into one shareable image instead of two separate files. It's also useful any time you're assembling a reference sheet for something downstream that wants a single combined image rather than two separate inputs (some IP-Adapter-style or edit-model workflows expect a single reference image rather than two), and for building simple visual diff previews while you're iterating on a workflow, without needing to open two files separately.

Installing it

ComfyUI Manager: search "ComfyUI-WJNodes." Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git

Restart ComfyUI. No models or heavy dependencies - this is straightforward image compositing.

Where to be careful

auto_scale resizing one image to match the other means the merged result isn't necessarily either image at its original resolution - if you need both halves preserved at full, untouched size, this node's automatic resize isn't what you want, and you should handle sizing explicitly yourself instead of relying on the default behavior.

This is another node from a pack with no public discussion trail anywhere - there's no forum thread confirming how, say, mismatched mask sizes interact with the merge if you supply mask1/mask2 alongside images of different sizes. If you're relying on both masks staying meaningful post-merge, it's worth previewing the output mask directly rather than assuming it lined up correctly, especially the first time you use this with masks in the mix.

CategoryWJNode/ImageEdit

Inputs (7)

NameTypeDefaultDescription
merge_directionCOMBOright4 options: right, left, up, down
auto_scaleBOOLEANtrue
output_modeCOMBOmerge3 options: merge, input1, input2
image1optIMAGE
image2optIMAGE
mask1optMASK
mask2optMASK

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
widthINT
heightINT