ComfyUI Node

1-x

The invert node the pack needed to spell out

By CoiiChan·Created about a year ago·Updated about a year ago· 2
1-x
  • imga
  • IMAGE
formularesult = 1 - imga

Every image utility library ends up defining "1 minus the image," because it's the single most repeated one-liner in compositing. Black becomes white, white becomes black, mid-gray stays mid-gray. If you've ever needed an inverted mask - a mask that's opaque where the original is transparent - this is the node. It's the pack's "not" operator.

The display name is 1-x, and the entire implementation is result = 1 - imga. That's it. No parameters beyond the image, because there's nothing to tune - subtraction from one is the whole trick.

When you'll reach for it

  • Mask inversion. The stock use. You've keyed out a sky and you want the foreground instead; you invert the mask. Every compositing tutorial eventually does this.
  • Reversing a gradient. For UV/texture work, 1 - u flips the coordinate field left-to-right. Invert the green channel and you've flipped it vertically. Two Oneminus nodes (or one formula) is how you mirror a UV map in this pack.
  • Falling-off effects. 1 - x turns a distance ramp into a proximity ramp - brightest at the source, fading out. The math the pack's Chroma_Key_Alpha uses internally is built on this shape.

Inputs and outputs

  • formula - result = 1 - imga, pre-filled and editable.
  • imga - the image to invert. Reference for output resolution.

One IMAGE output.

Install

ComfyUI Manager → search "FuncAsTexture", or:

cd ComfyUI/custom_nodes
git clone https://github.com/CoiiChan/ComfyUI-FuncAsTexture-CoiiNode
# restart ComfyUI

No models, no requirements.txt. Category: FunctionAsTexture.

Notes

  • It works per-channel. Inverting an RGB image produces the complementary-color negative, not a grayscale invert. If you want a grayscale inversion (which is usually what "invert mask" means), desaturate first with the pack's Desaturation node, or extract one channel.
  • Inputs outside 0–1 get weird. 1 - 2.0 = -1.0. If you're inverting something that already overflowed, clamp first - the pack's Clamp node is the companion here.
  • There's no subtlety to the default formula, which is the point: this is the one node in the pack where you genuinely can't set it up wrong.

It's the most boring node in the pack and one of the most useful. Keep it in mind the moment a mask or gradient is backwards - it's a single node between you and the fix.

CategoryFunctionAsTexture

Inputs (2)

NameTypeDefaultDescription
formulaSTRINGresult = 1 - imga
imgaoptIMAGEOptional ,Reference size ,Default =(1,512,512,3)

Outputs (1)

NameTypeDescription
IMAGEIMAGE