Image Compare (RMBG) 🔀🖼️
Image Compare (RMBG)
- image1
- image2
- IMAGE
- DIFF_MASK
You ran the same photo through BiRefNet and InSPyReNet, because that comparison has never been settled and everyone says to test both on your own images. Now you have two preview windows and no idea which one actually kept the hair. Alt-tabbing is useless here - your eye re-adapts to whatever it saw last, and by the third flip both cutouts look identical.
Image Compare (RMBG) is the boring fix: both images in one node, one on top of the other, with a draggable split line. It's the small utility at the end of a background-removal graph, and it exists because "just look at them" doesn't scale.
What it actually is
This is one of the two utility nodes 1038lab added in v3.2.0 (the other is the Resolution Selector), and it's the interactive sibling of the pack's older side-by-side Compare node, which is still there for labelled collages.
The incumbent for this job is rgthree's Image Comparer - it's in a pack most people already have, and "Image Comparer" shows up in something like a hundred corpus threads. What this one adds is that the comparison is data too: you get the pixel difference out as a mask you can wire somewhere, not just a slider you look at. That matters, because the community's own attempt at a background-removal arena died partly on exactly this problem - a diff view that can't tell you which of the two masks was the culprit isn't objective, it's just another thing to squint at.
How it works
The backend does all the work before you touch anything. Both inputs get their alpha stripped, batches get aligned, and if match_size is on, image2 is bicubic-resized to image1's dimensions. Then it computes the difference and composes an output for the selected mode, saving both inputs into ComfyUI's temp folder tagged slot 1 and slot 2. The frontend loads those two files back over /view and paints them on the node canvas. Dragging the line is pure frontend - it does not re-run your graph.
What each mode gives you:
left_right/up_down- a hard split. Left (or top) half is image1, the rest is image2. This is the classic wipe.overlay- a 50/50 blend, and you can drag on the canvas to slide the mix.difference- the raw absolute difference as an RGB image.side_by_side- the two images concatenated horizontally.highlight_diff- image1's luminance as a grey base, with pure red painted wherever pixels differ by more than 0.15 (that threshold is hardcoded, not a widget).
The inputs and outputs that matter
image1 is your "before" and image2 your "after" - that's the author's own framing in the tooltip, and it decides which half shows up on the left. mode is the dropdown above. match_size (default on) is the only real decision you make.
Two outputs. IMAGE is the composed image for the current mode, i.e. the flattened version of what you're looking at. DIFF_MASK is the mean absolute channel difference, clamped between 0 and 1 - a soft, continuous greyscale mask, not a binary one. Feed it to a MaskToImage if you want to eyeball it, or into a blur and a threshold if you want an actual region mask out of it.
Installing it
Same pack, same steps as any other RMBG node:
cd ComfyUI/custom_nodes
git clone https://github.com/1038lab/ComfyUI-RMBG
Then install the pack's requirements - from the ComfyUI-RMBG folder:
./ComfyUI/python_embeded/python -m pip install -r requirements.txt
Or search Comfyui-RMBG in ComfyUI Manager and restart. No model download is needed for this node specifically; the auto-downloads are for the RMBG/SAM/BiRefNet nodes.
Where people get burned
Nothing appears until you queue once. The node saves its images during execution, so the canvas starts empty reading "Connect images & run to compare."
match_size is a confound when you're judging edges. It resizes image2 with bicubic interpolation. If you're comparing two upscalers or two mask refinements, that resample softens your candidate before you judge it. If both branches come from the same source image you don't need it on anyway.
Turning match_size off doesn't show you everything. When the sizes differ, the code crops both images to the smaller width and height - so you silently lose the edges of the larger one.
Batches get forced together. One image against a batch of eight repeats the single image eight times; two mismatched batches truncate to the shorter one.
side_by_side doubles your width. Don't accidentally wire that IMAGE output into a save or upscale path and wonder why everything downstream changed shape.
One pack-level thing worth saying plainly: this is a GPL-3.0, models-everywhere pack that pulls in onnxruntime, onnxruntime-gpu, groundingdino-py, transparent-background and friends. If all you wanted was a compare node, rgthree already has one. Install RMBG because you want the removers; take the comparison node as a bonus.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | First image to compare (e.g. before / original). | |
| image2 | IMAGE | Second image to compare (e.g. after / processed). | |
| mode | COMBO | left_right | Comparison mode. |
| match_size | BOOLEAN | true | If True, resize image2 to match image1 dimensions when they differ. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| DIFF_MASK | MASK | — |