ComfyUI Node

🌅Image Difference

Show exactly what changed between two images — Image Difference makes the invisible visible

By KoreTeknology·Created 2 years ago·Updated 2 years ago· 16
🌅Image Difference
  • image
  • image2
  • IMAGE

Give it two images and it tells you where they differ - pixel by pixel, as an image. Black means "identical here," and the brighter a pixel is, the more the two images disagreed at that spot. It sounds like a niche trick, but once you've spent an hour wondering whether your upscaler actually changed anything, or whether that seed really is reproducible, Image Difference becomes the node you reach for first.

How it works

It's a thin wrapper around PIL's ImageChops.difference, which computes the absolute value of the per-pixel channel difference between two images. Inputs:

  • image - the first IMAGE.
  • image2 - the second IMAGE.

Output is a single IMAGE: the difference map. It's an output node, so it previews on the canvas; you can also wire it onward (say, into an image analyzer or a blur node to quantify the change). Keep in mind it's channel-wise RGB difference - identical pixels vanish to black, any shift in color or brightness lights up.

The use cases that make it worth having

  • A/B testing seeds or prompts. Generate the same scene with two seeds and diff them. Fully black (or nearly) means the seed was effectively ignored or the images are identical; bright regions show you exactly which areas moved.
  • Verifying an upscale. Diff the low-res original against the upscaled-then-downscaled result. The difference map is your honesty check for whether an upscaler is inventing detail or preserving it.
  • Change detection in animation or video pipelines. Diff consecutive frames to find the frames that actually changed, or spot a watermark/artifact that moved.

Where people get burned

The images must be the same size. ImageChops.difference raises a ValueError if they aren't, and unlike the rest of the pack's nodes there's no auto-resize here - feed it mismatched tensors and it just dies. Upscale or crop one side first.

Two more honest notes. The output is raw absolute difference, which is frequently dim and hard to read on screen - don't be alarmed that the result looks nearly black; that's usually a good sign. There's no factor or blend control either: the source even has a factor parameter commented out, so if you want to overlay the diff back onto the original at partial opacity, you'll need a separate blend/mix node. And like the brightness/contrast pair, it forces RGB, so alpha channels don't survive.

Install

Part of the ComfyUI Production Nodes Pack by Uriel Deveaud (KoreTeknology). Install via ComfyUI Manager (search "ComfyUI Production Nodes Pack") or:

cd ComfyUI/custom_nodes
git clone https://github.com/KoreTeknology/ComfyUI-Nai-Production-Nodes-Pack
cd ComfyUI-Nai-Production-Nodes-Pack
pip install -r requirements.txt

Restart ComfyUI afterward. No models, no heavy deps - it's PIL only. Find it under image/postprocessing; like the rest of the pack, it's filed into an existing menu category rather than a new root folder. The class name in workflow JSON is Image Difference (with a space). It's pre-alpha pack, but a two-input PIL difference is about as low-risk as custom nodes get.

Categoryimage/postprocessing

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
image2IMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE