Create Magic Mask
Procedural blobby masks that animate over frames
- mask
- mask_inverted
Sometimes you don't want a precise mask - you want an organic, evolving blob that morphs across a sequence of frames, for driving a transition, an animated reveal, or some noise-masked latent trickery. CreateMagicMask generates exactly that: a batch of procedural, smoky masks that shift shape frame to frame, no input image required. It's the "give me an interesting animated mask out of nothing" node.
It comes from Kijai's KJNodes, which has a whole masking/generate family - nodes that synthesize masks procedurally rather than deriving them from a photo. This is the freeform, painterly one. If you've done any AnimateDiff or video work you know how much of the craft is in masks that change over time; this is one way to get those without keyframing anything by hand.
How it works
Under the hood it's procedural noise shaped into soft blobs and evolved across the frame count. You don't paint anything - you set a seed and a few shape parameters and it renders a batch of grayscale masks that flow from one form into another. Because it's seeded, the same settings reproduce the same animation, which matters when you're iterating on a workflow and want the mask to stay put while you change other things.
The inputs and outputs that matter
Everything's required and most of it is "nudge until it looks right," but the ones that actually shape the result:
frames(default 16) - how many masks in the batch. Match this to your video length.seed(default 123) - which pattern you get. Change it to roll a completely different blob; keep it to lock the one you like.distortion(default 1.5) - how warped and turbulent the shapes are. Low is calmer and rounder, high gets chaotic.depth(default 12) - the complexity/detail of the shapes. More depth, more fine structure.transitions(default 1) - roughly how many distinct shape states it morphs through across the batch. Turn it up for a mask that changes more often.frame_width/frame_height(default 512) - the mask resolution; match your working size.
Two outputs: mask and mask_inverted. Grab whichever polarity your downstream node wants - the inverted output saves you from bolting on a separate invert node.
How to install it
ComfyUI Manager: search KJNodes for ComfyUI, install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt
then restart (portable users run pip via python_embeded\python.exe). No models to fetch.
Common issues & troubleshooting
It looks like random static, not shapes. Push distortion and depth down, not up. High values on both turn the mask into noise; the pretty, flowing blobs live in the lower-to-mid range. Roll the seed a few times too - some seeds are just uglier than others.
The animation barely moves. With transitions at 1 and a short frames count, the mask evolves slowly. Raise transitions, or lengthen frames to give it room to breathe.
Resolution mismatch downstream. The mask comes out at frame_width × frame_height. If it doesn't match the latent or image you're masking, ComfyUI will complain or silently resize it - set the dimensions to your actual working size to avoid surprises.
You wanted a mask of something specific. Wrong node. This is a procedural generator with no notion of your image content. For masking an actual subject, use a detector/segmentation route (SAM, a detailer pipeline) and come back here only when you want abstract animated shapes.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| frames | INT | 162–4096 | — |
| depth | INT | 121–500 | — |
| distortion | FLOAT | 1.500–100 | — |
| seed | INT | 1230–99999999 | — |
| transitions | INT | 11–20 | — |
| frame_width | INT | 51216–4096 | — |
| frame_height | INT | 51216–4096 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| mask_inverted | MASK | — |