图像对比
Stop flapping between two preview nodes
- image_a
- image_b
- IMAGE
Every workflow that does something to an image ends with the same question: is the new one actually better? Comparing two thumbnails side by side on a canvas is nearly useless - you end up squinting at 200px previews, switching tabs, forgetting which one you were looking at. 图像对比 (QG_ImageCompare) puts both versions in one panel with a slider down the middle, and it's the node I'd reach for before any global workflow change.
How it works
Two IMAGE inputs, image_a and image_b. The panel gives you three ways to look:
Slide - a vertical line follows your pointer; left of it you see A, right of it you see B, with small A/B labels riding the line. This is the mode that catches subtle stuff: a shifted eye, a slightly different skin tone, a background that gained a texture it shouldn't have.
A / B - lock the panel to one image and look at it properly. Beats flicking between them.
Erase - B sits on top of A as a layer, and you paint it away to reveal A underneath. Brush width and softness are adjustable, you can invert which is on top, and there's undo and clear. Keyboard: [ and ] change brush width, Shift with them changes softness, E erases and B paints back, Ctrl+Z undoes, Esc cancels the stroke in progress. Right or Ctrl-click gives you the opposite of the current tool.
Both inputs are batches; the panel previews the first frame of each. Output is IMAGE, and it's image_a, entire batch, untouched. That detail is why the node is genuinely useful rather than a curiosity: it can sit in the middle of a chain instead of hanging off the end. Put it after your upscale, keep going into the save node, and the comparison costs you one node and no rewiring.
Saving the erase result
Erase mode has a save button, and it writes the mixed image to ComfyUI's output directory at full resolution - not an upscaled screenshot of the panel. Tick the PSD option and you get a two-layer PSD as well, with your strokes as a layer mask on the top layer, plus a mask PNG. If you've ever tried to explain "this region is wrong" to someone in a Discord thread, that's the feature.
Strokes are stored as stroke data, not as a bitmap. So the saved file is re-rendered at the original image size regardless of how big the panel is on your screen, and old strokes are discarded automatically when you swap in a differently sized image.
Inputs and outputs
image_a(required, IMAGE) - the baseline. First frame is preview A; the whole batch comes out of the output.image_b(required, IMAGE) - the candidate. First frame is preview B.filename(optional, STRING) - a name for saved files. Wire a filename-carrying string in and it gets cleaned up (directory and extension stripped); leave it unwired and whatever you typed on the node is used.- Output
IMAGE-image_a, unchanged.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/live1617/ComfyUI-QG-tools
Restart ComfyUI fully. Console should print [QG-tools] v0.9.2 加载完成 | 节点数 24; if it doesn't, nothing below matters. Manager users can search ComfyUI-QG-Tools where the Registry listing exists. No pip dependencies - the pack's requirements file is comments only on purpose, so Manager's pip step is a no-op.
The node (and the save route behind it) is ported from AusBoss's image compare, MIT, and the pack keeps the original licence in licenses/. Search the node by compare, ab compare, difference or 图像对比.
Where people get burned
Clipboard copy is origin-restricted. The copy button only works on pages served from localhost or https. Running ComfyUI on a plain-http LAN address will get you a silent no-op. Save to disk instead.
The "stays on the result" behaviour surprises people. When your pointer leaves the panel it settles on whichever image it thinks is the result - A or B, decided by the wiring: B is assumed to be the derived version, unless the graph shows B feeding the thing that produced A. If it guesses wrong, that's a setting (QG-tools › 图像对比 › 停在结果上) you can turn off so it just snaps to the full image.
Batch inputs are asymmetric. One frame each is previewed. If your two batches have different content per frame, the comparison is between frame 0 and frame 0 - not between the frames you care about. Restructure so the frames you want compared are first, or split the batch before the compare node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | 基准批次。取第一帧作为预览 A,整批原样从输出送出。 | |
| image_b | IMAGE | 对比批次。取第一帧作为预览 B,在面板上滑过、切到 B,或用橡皮擦擦开时露出。 | |
| filenameopt | STRING | 可选。橡皮擦保存时的文件名,比如源图的文件名;目录和扩展名会被去掉。不接的话用节点上打的名字。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | 输入 A 的一批图,原样送出,方便接在流程中间。 |