Nodes/Nodes for use with real-time applications of ComfyUI/Resize Mask Node πŸ•’πŸ…‘πŸ…£πŸ…
ComfyUI Node

Resize Mask Node πŸ•’πŸ…‘πŸ…£πŸ…

Proximity-Based Resizing, Live

By ryanontheinsideΒ·Created 2 years agoΒ·Updated about a year agoΒ· 82
Resize Mask Node πŸ•’πŸ…‘πŸ…£πŸ…
  • input_mask
  • MASK
β—„always_executetrueβ–Ί
β—„x_pos0.50β–Ί
β—„y_pos0.50β–Ί
β—„size0.20β–Ί
β—„min_size0.10β–Ί
β—„max_size0.40β–Ί
β—„resize_strength0.10β–Ί

Most mask nodes are static - you draw once and it stays put. Resize Mask Node is the opposite: it maintains a living circular mask whose size depends on what else is in the frame. The idea is proximity. If something in your input mask wanders close to the center, the circle shrinks. If it pulls away, the circle grows. It's a "this thing is near me" indicator turned into a mask you can feed straight into compositing or inpainting.

It's built to pair with the motion and tracking half of this pack. Drop a hand-tracking mask, a motion mask, or any segmentation output into input_mask, and the node watches how close that blob gets to a center point you choose. The output is a smooth circle mask that reacts live - exactly the kind of "the effect intensifies as you lean in" behavior that makes real-time ComfyUI demos feel alive.

Mechanically it's a frame-to-frame state machine. The node keeps its own center (x_pos, y_pos as 0–1 fractions) and current size (as a fraction of the frame). Each execution it draws a circle at that center, then looks at the input mask: if the nearest foreground pixel to the center is far away, the circle grows toward max_size; if something's right on top of the center, it shrinks toward min_size. No foreground at all reads as "nothing near me," so the mask eases back out to its maximum - which is usually what you want, an idle state at full effect.

The knobs that matter

  • x_pos / y_pos - where the circle lives, as 0–1 coordinates. 0.5/0.5 is dead center.
  • size - the starting size, and the value it returns to before it gets pushed around.
  • min_size / max_size - the floor and ceiling for how far it'll shrink or grow. The gap between them is your whole dynamic range, so make it wide enough to feel.
  • resize_strength - how aggressively the mask responds to what it sees. Lower = sluggish, higher = twitchy.
  • always_execute - on by default; this node only works if it runs every frame.

Output is a single MASK.

Install

From ryanontheinside/ComfyUI_RealtimeNodes, via ComfyUI Manager (search "Control Nodes" or "RealtimeNodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RealtimeNodes
cd ComfyUI_RealtimeNodes
pip install -r requirements.txt

Restart and look in Realtime Nodes/control/mask.

Gotchas

Because the node keeps state between executions, it's sensitive to ComfyUI's state resets - a fresh queue run with cleared state can snap the circle back to size mid-stream, so expect a little pop if you're restarting constantly. Also, the mask only responds to stuff that's already been turned into a mask: it needs a real MASK input, not an image, so the hand/motion pipeline upstream has to do that conversion first. And keep in mind the output is a hard-edged circle - it's a silhouette, not a soft glow. If you want a feathered falloff, blur it after. Honestly, this is one of the more niche nodes in the pack, but if your idea involves a mask that reacts to a person moving, it's the fastest way to get there.

Categoryreal-time/control/mask

Inputs (8)

NameTypeDefaultDescription
always_executeBOOLEANtrueWhen enabled, the node updates every execution
input_maskMASKβ€”
x_posFLOAT0.500–1Initial X position (0-1)
y_posFLOAT0.500–1Initial Y position (0-1)
sizeFLOAT0.200.01–1Size of the mask relative to image size
min_sizeFLOAT0.100.01–1Minimum size the mask can shrink to
max_sizeFLOAT0.400.01–1Maximum size the mask can grow to
resize_strengthFLOAT0.100–1Strength of the resize effect

Outputs (1)

NameTypeDescription
MASKMASKβ€”