Nodes/ComfyUI-WJNodes/image math value
ComfyUI Node

image math value

Deprecated — here's what it does and why to use the v1 replacement

By 807502278·Created 2 years ago·Updated 11 months ago· 20
image math value
  • a
  • b
  • c
  • d
  • image
  • mask
  • shape
expressiona+b
clamptrue

Straight from the node's own description: this node is deprecated. The author explicitly says to use image_math_value_v1 instead. It's still shipped in the pack - which is why it's covered here - but if you're setting up a new workflow from scratch, go find the v1 replacement rather than building around this one; you'll likely save yourself a migration later when this one eventually gets pulled.

The inputs and outputs that matter

With that said, here's what it does, since plenty of older workflows still have it wired in and you might be trying to understand one you didn't build. It's a scalar-and-image calculator: you write an expression (default a+b) using up to four inputs - a and b as images, c and d as masks - and it evaluates that expression against them. clamp, on by default, limits the resulting pixel values to the 0–1 range; the author's own advice is to turn it off if you're planning to chain the output into another image_math_value node afterward, since clamping early throws away values a second pass might need.

Three outputs: image and mask carry the result if the expression resolves to something image-shaped, and shape - a LIST - gives you the tensor's dimensions directly. That shape output is a nice debugging aid on its own: wire it to a preview and you can immediately see whether your expression produced the batch size, resolution, and channel count you expected, without guessing from a thumbnail.

One quirk called out explicitly in the node's own description: it automatically strips the alpha channel off any image input before doing the math. If you're feeding in a 4-channel (RGBA) image expecting the alpha to carry through the calculation, it won't - this node silently drops it first.

Installing it

It's part of the ComfyUI-WJNodes pack, same as every node here - install the whole thing once. ComfyUI Manager, search "ComfyUI-WJNodes," install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git

You'll find it under WJNode → ImageEdit. No models to download, no extra dependency for this specific node.

Where people get burned

If you landed here because ComfyUI Manager flagged a missing node called image_math_value in a workflow you downloaded, that's your cue to check whether the workflow's author actually meant to use it, or whether it's simply an older save from before image_math_value_v1 existed. Either way works once installed - this node hasn't been removed from the pack, just superseded - but don't build new graphs around it. For new work, any_math and any_math_v2 in the same pack cover the same expression-based territory with more inputs and without a deprecation notice attached.

One last practical note: deprecated doesn't mean broken. The node still runs exactly as described here, and swapping an old workflow's image_math_value node for image_math_value_v1 isn't always a drop-in change if the newer node's inputs shifted - so if you're touching an inherited graph and it's already working, it's often less risk to leave it alone than to force a migration you don't need yet. Save the swap for the next time you're rebuilding that part of the graph anyway.

CategoryWJNode/ImageEdit

Inputs (6)

NameTypeDefaultDescription
expressionSTRINGa+b
clampBOOLEANtrue
aoptIMAGE
boptIMAGE
coptMASK
doptMASK

Outputs (3)

NameTypeDescription
imageIMAGE
maskMASK
shapeLIST