Nodes/ComfyUI-Yuan/Image Judgment
ComfyUI Node

Image Judgment

An A/B image switch that measures pixel difference instead of 'quality'

By the-hexer·Created 2 years ago·Updated 10 months ago· 15
Image Judgment
  • image1
  • image2
  • IMAGE
â—„threshold32.00â–º

Let's be straight about the name: "Image Judgment" sounds like an AI critic that eyeballs two images and declares a winner. It is not that. It's a pixel-difference threshold that routes one of two images through based on how much they've changed. No model, no API, no opinion about aesthetics - just math with a console print. Once you know that, it's actually a handy little switch, and it's honest about being dumb.

What it does

Feed it two images and a threshold. It converts both to Lab color space (the perceptual-ish one where differences roughly match how humans see color), measures the average color difference across the region where they actually differ, and then:

  • difference < threshold → image1 comes out
  • difference ≥ threshold → image2 comes out

The console prints the measured value (Color Difference in Difference Area: ...) on every run, which is the calibration gift - more on that below.

The inputs that matter

  • image1 / image2 - both IMAGE tensors. It handles the boring edge cases for you: if image2 is a different resolution it gets bilinearly interpolated to match, and if image2 has fewer frames than image1's batch, it's repeated. Note it only actually compares the first frame of each batch.
  • threshold - default 32, range 0.1–100. The unit is an average Lab ΔE over the changed pixels, so it's a rough "how visibly different" number. A default of 32 is a large change - think a new object or a full recolor. For subtle differences you'll be down in single digits.

When you'd reach for it

It's a change-detection gate, and the classic use is A/B-style automation: run a second pass (a refiner, an upscale, an edit) and let the node decide whether the result actually changed enough to keep. If your refiner produces a pixel-identical or near-identical image you probably don't want to pay the cost of keeping it; if it changed a lot, you want the new one. Same logic works for "did this inpaint region actually get modified?" - the node becomes a conditional branch that either keeps the original or the variant.

The traps

The output is an IMAGE, not a number or a boolean - the judgment is baked into which image comes out. You can't read the score off the wire and use it in a condition elsewhere (the pack's separate SomethingShow/TensorShow nodes are how you'd peek at values if you really need to). And "judgment" really is just color difference in the differing region: transparent pixels (alpha ≤ 0.1) are ignored, and two images that are identical in the opaque area produce a difference of 0.0, so image1 always wins.

Calibration tip: run it once with the threshold wherever, read the console value, then set the threshold a hair below that if you want to catch changes that small. The printed number is the only documentation you're going to get - the README doesn't mention this node at all.

Install

ComfyUI Manager → search ComfyUI-MoneyMaker (or Yuan), install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Cyber-Blacat/ComfyUI-Yuan

No models, no keys, no extra deps beyond what ComfyUI already has. It sits under MoneyMaker😺 in the node menu.

It's niche and it won't win any beauty contests against a real scoring model, but for "keep the result only if it actually changed," it's a zero-cost, zero-dependency way to make the graph decide for itself.

CategoryMoneyMaker😺

Inputs (3)

NameTypeDefaultDescription
image1IMAGE—
image2IMAGE—
thresholdFLOAT32.000.1–100—

Outputs (1)

NameTypeDescription
IMAGEIMAGE—