Dilate Mask Linear Infinite | Akatz
Multiple colors, one schedule string
- mask
- IMAGE
Dilate Mask Linear Infinite is the scripted, colorized upgrade to the plain linear dilate node. Instead of one growth rate for the whole clip, you give it a schedule string - "start growing this mask at frame 10 at 4 px/frame, then kick in a second color at frame 60" - and it renders each mask as a colored fill on an output IMAGE. It's the node behind a lot of Akatz's workflow examples, and it's the one that turns a simple mask animation into a designed visual layer.
"Linear" means the growth is constant between the points you specify; "infinite" means it's driven by a schedule string rather than the batch length, so you can have multiple dilation segments, each with its own start frame, speed, and color. You get a full-frame IMAGE out - background color, growing colored masks, optionally the subject composited on top. That's ready-to-use visual content, not a mask you still have to style.
How it works
The schedule string is parsed by regex, so format is everything. Each segment looks like:
(start_frame, pixels_per_frame, (r, g, b)),
e.g. (0, 30, (0, 255, 0)), (45, 60, (255, 0, 0)),. Each entry starts a dilation layer at start_frame with dilation_speed pixels per frame, filled with its color. timing_mode lets you express start_frame as a raw frame number or as a percentage of the total frames (0–1) - handy when you don't know the final length. The segments are composited in order over initial_background_color, and should_composite_subject draws the source mask itself in subject_mask_color on top, which gives the classic "subject stays, ring grows around it" look.
quality_factor (default 0.25) trades speed for smoothness; the author recommends 0.25–0.15 for production. Lower is slower and rounder.
Inputs
mask- the input MASK (per-frame or a single mask).dilation_schedule- the(start, speed, (r, g, b))string. This is where you'll make mistakes.quality_factor- speed/quality, default 0.25.timing_mode-FrameorPercent.should_composite_subject,subject_mask_color,initial_background_color- compositing options.
Output is a single IMAGE batch - colored dilation layers over the background, with optional subject.
Installing it
Part of akatz-ai/ComfyUI-AKatz-Nodes. Install via ComfyUI Manager (search "AKatz") or:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-AKatz-Nodes
cd ComfyUI-AKatz-Nodes
pip install -r requirements.txt
Restart ComfyUI. No model downloads; requirements are numpy, torch, opencv-python and pydub.
Common issues
The schedule string is the whole game, and it's strict: the parser raises "No valid matches found in the provided schedule string" if your format is off - missing parens, extra spaces inside a tuple, or a non-integer speed all break it. Keep the exact (start, speed, (r, g, b)), shape. Second, timing_mode changes what start_frame means, so a schedule tuned in Frame mode breaks in Percent mode. And if you're hand-writing a long schedule, this node has a sibling - Float List To Dilate Mask Schedule - that generates the string from a float list automatically.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| dilation_schedule | STRING | (0, 30, (0, 255, 0)), | — |
| quality_factor | FLOAT | 0.250–1 | — |
| timing_mode | COMBO | Frame | 2 options: Frame, Percent |
| should_composite_subject | BOOLEAN | false | — |
| subject_mask_color | STRING | 255, 0, 0 | — |
| initial_background_color | STRING | 0, 0, 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |