Nodes/ComfyUI 1hewNodes/Image Area Compare
ComfyUI Node

Image Area Compare

One boolean that saves you a whole branch

By 1hew·Created about a year ago·Updated about 16 hours ago· 33
Image Area Compare
  • a
  • b
  • bool
operator==

What it's for

This one is plumbing, and it's worth being honest about that: Image Area Compare takes two IMAGE inputs, compares their pixel area, and outputs a single boolean. That's the whole node.

Why would you want it? Because graphs get built for one input size and then get fed a different one. You have a workflow that upscales anything under a megapixel, or a branch that only runs the heavy detail pass when the source is actually large enough to justify it, or a sanity check that the crop you just made isn't bigger than the original. All of those are the same question - "is A bigger than B?" - and without a node like this you're hand-checking a resolution before every run.

It's the image counterpart of the pack's Int Number Compare, and it caps the honest end of the logic-node spectrum. Further down that spectrum is the wildcard-any-type routing that the ecosystem has spent years arguing about - the "Please Stop using the Anything Anywhere extension" backlash is real, and it exists because type-erasing convenience nodes make a graph impossible to debug. This one declares IMAGE on both sides, emits BOOLEAN, and does exactly what the label says.

How it works

The mechanism is about as small as a node can be. Each input's total pixel count is height × width, read straight off the tensor shape. Then the selected operator decides:

  • ==, !=, >, >=, <, <= - the same six as the numeric compare nodes.

Two things follow from taking the area from the tensor shape rather than the content:

Batch size doesn't matter. Every frame in an IMAGE batch shares the same dimensions, so a 12-frame batch and a single frame of the same resolution compare identically. You don't have to think about it.

It's dimensions, not subject area and not file size. A 2048×2048 image is 4,194,304 pixels whether it's a portrait or a flat colour swatch, and whether it's a 300KB JPEG or a 12MB PNG. If you actually meant "which of these has more stuff in it", this is the wrong node.

Empty or non-image input, or any exception inside, returns false. No error dialog, no red outline.

Inputs and output

a - the left image; width × height is the left value. operator - == by default. The six operators above. b - the right image.

Output is bool (BOOLEAN). Wire it into anything that takes a boolean condition. In this pack that's Any Switch Bool, which routes one of two inputs based on it, lazily - so the branch you switch away from isn't even executed. That's the classic use: HD source goes one way, small source goes the other, and you only pay for the path you took. If you're coming from rgthree habits, note the difference in shape - rgthree's Any Switch is the fallback kind with no selector at all, passing the first non-empty input. An A/B branch driven by a computed condition is what you want here.

Typical wiring: run a resize node, compare its output against a reference size to confirm the resize actually produced what you expected, or compare an original against a crop to prove the crop is smaller. The pack's own Image Minimum Area is the natural companion - that one grows an image until it reaches an area target, this one is how you check on it.

Install

Part of ComfyUI 1hewNodes. Manager → search the pack title, or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
pip install -r ComfyUI-1hewNodes/requirements.txt

Restart when it's done. No models, no downloads - comparing two tensor shapes needs nothing but torch, which you already have. The requirements list is long because of the pack's other nodes (rembg, ultralytics, av and friends), so don't be alarmed by the install time.

Common issues

It returns false and you think it's broken. Two cases produce a silent false: a genuinely false comparison, and an input that isn't a usable image tensor. Same output either way. If a branch never fires, check the wiring first - an unconnected input looks exactly like "the condition wasn't met."

You're comparing the wrong quantity. People reach for this expecting a quality check. It isn't one. A huge blurry image wins against a sharp small one, every time. Resolutions and upscale-path decisions are the intended use.

The pack needs a current ComfyUI. These nodes are written against the newer V3 node schema (comfy_api.latest), so on an older install the pack registers nothing at all. Update ComfyUI, then restart.

Category1hewNodes/logic

Inputs (3)

NameTypeDefaultDescription
aIMAGE
operatorCOMBO==6 options: ==, !=, >, >=, <, <=
bIMAGE

Outputs (1)

NameTypeDescription
boolBOOLEAN