Nodes/RyanOnTheInside/Mask Math [DEPRECATED] βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
ComfyUI Node

Mask Math [DEPRECATED] βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜

Combine and time-window masks the old way

By ryanontheinsideΒ·Created 2 years agoΒ·Updated 5 months agoΒ· 852
Mask Math [DEPRECATED] βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
  • masks
  • mask_b
  • MASK
β—„strength1.00β–Ί
β—„invertfalseβ–Ί
β—„subtract_original0.00β–Ί
β—„grow_with_blur0.0β–Ί
β—„start_frame0β–Ί
β—„end_frame0β–Ί
β—„effect_duration0β–Ί
β—„temporal_easingβ–Ύβ–Ί
β—„palindromefalseβ–Ί
β—„combination_methodβ–Ύβ–Ί

Same story as this pack's Audio Latent Blend: the node's own display name says "Mask Math [DEPRECATED]", right there in the ComfyUI search list, so treat it as legacy rather than the tool you reach for on a new build. It still runs - the pack hasn't stripped the code - but everything it does now has a modern equivalent living in the newer "Flex" mask nodes in this same pack, which add the feature-reactive modulation this one never had.

What it actually does

Mask Math combines two masks and applies a time window to when that combination is active - which makes sense given its category is "TemporalMasks." It takes masks (your primary input, single mask or a batch/sequence), optionally mask_b (a second mask to combine against), a combination_method (add, subtract, multiply, minimum, maximum), and a set of post-processing knobs: invert flips black/white on the result, subtract_original peels a portion of the original mask back out after combination, and grow_with_blur softens/expands edges with a Gaussian blur.

The temporal side is the part that separates this from a plain mask-combine node: start_frame, end_frame, and effect_duration define when in a frame sequence the effect is active, temporal_easing (ease_in_out, linear, bounce, elastic, none) shapes how the effect ramps in and out rather than switching on like a hard cut, and palindrome makes the effect play forward then reverse within its duration - useful for a mask that should pulse rather than just appear once.

Inputs and outputs

  • masks (required, MASK) - the mask or mask sequence being processed.
  • strength (0–1) - overall intensity of the effect.
  • combination_method and mask_b - how (and with what) to combine, if you're combining at all.
  • start_frame / end_frame / effect_duration / temporal_easing / palindrome - the timing controls that give this node its "temporal" name.
  • Output - a single MASK.

If you don't need the timing behavior at all, note that the strength, invert, subtract_original, and grow_with_blur options work as a general mask-touch-up toolkit even with the temporal window left at its defaults (start/end at 0, meaning full range).

Installing it

Install via ComfyUI Manager (search RyanOnTheInside) or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside

Run pip install -r requirements.txt, then restart ComfyUI. This node has no unusual dependency of its own beyond the standard image/mask processing libraries the rest of the pack already needs.

Common issues

The practical trap is discoverability: because it's deprecated but not hidden, it still shows up in node search right alongside the newer Flex mask tools, and nothing stops a new workflow from using it by accident. If you're starting fresh, look at the pack's Flex-prefixed mask nodes first - they cover the same combine-and-shape territory with an opt_feature input this one lacks, meaning the blend strength or timing can react to audio or motion instead of being fixed per-run.

If you do use it: end_frame and effect_duration both default to 0, which the tooltips define as "until end" / "full range" rather than zero-length - so don't be surprised the effect spans your whole sequence by default even though the numeric field reads 0. And as with the rest of this pack, a totally unresponsive node on load points at a missing pip install -r requirements.txt, not a problem with this specific node's logic.

CategoryRyanOnTheInside/Masks/TemporalMasks

Inputs (12)

NameTypeDefaultDescription
masksMASKInput mask or sequence of masks to be processed (MASK type)
strengthFLOAT1.000–1Overall strength of the mask effect (0.0 to 1.0)
invertBOOLEANfalseWhen enabled, inverts the mask output (black becomes white and vice versa)
subtract_originalFLOAT0.000–1Amount of the original mask to subtract from the result (0.0 to 1.0)
grow_with_blurFLOAT0.00–10Amount of Gaussian blur to apply for mask growth (0.0 to 10.0)
start_frameINT00–1000Frame number where the effect begins (0 to 1000)
end_frameINT00–1000Frame number where the effect ends (0 to 1000, 0 means until end)
effect_durationINT00–1000Number of frames over which the effect is applied (0 to 1000, 0 means full range)
temporal_easingCOMBOControls how the effect strength changes over time ('ease_in_out', 'linear', 'bounce', 'elastic', 'none')
palindromeBOOLEANfalseWhen enabled, the effect plays forward then reverses within the specified duration
mask_bMASKSecond mask to combine with the input mask (MASK type)
combination_methodCOMBOMathematical operation to apply ('add', 'subtract', 'multiply', 'minimum', 'maximum')

Outputs (1)

NameTypeDescription
MASKMASKβ€”