Create Magic Mask(CreateMagicMask)
This node generates grayscale image sequences with fractal or noise characteristics as masks based on a coordinate grid and random transformation algorithms, controlling parameters such as depth and distortion.
Create Magic Mask
The Create Magic Mask node generates grayscale image sequences with fractal or noise characteristics as masks, based on a coordinate grid and random transformation algorithms, by controlling parameters such as depth and distortion.
The Create Magic Mask node is a tool for generating dynamic, abstract masks. It algorithmically creates a series of black-and-white mask patterns that change over time, which can be used to control specific areas in image generation or video processing. This node is particularly suitable for creative workflows requiring irregular, organic-shaped masks.
Node Functionality
This node generates grayscale image sequences with fractal or noise characteristics as masks, based on a coordinate grid and random transformation algorithms, by controlling parameters such as depth and distortion. Its core is the magictex module, which produces deterministic random patterns based on a seed value and supports smooth transitions between multiple pattern states over a specified number of frames, ultimately outputting as the standard MASK data type.
Node Parameter Description - Create Magic Mask
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
frames | INT | Yes | 16 | 2 - 4096 (Step: 1) | frames (input parameter): Specifies the total number of frames for the generated mask animation. Range is 2 to 4096, used to define the sequence length. |
depth | INT | Yes | 12 | 1 - 500 (Step: 1) | depth (input parameter): Controls the computational depth or iteration count for pattern generation, affecting the detail complexity of the mask. Range is 1 to 500. |
distortion | FLOAT | Yes | 1.5 | 0.0 - 100.0 (Step: 0.01) | distortion (input parameter): Sets the distortion intensity of coordinates; higher values result in more severe pattern deformation. Range is 0.0 to 100.0, step 0.01. |
seed | INT | Yes | 123 | 0 - 99999999 (Step: 1) | seed (input parameter): The seed value for the random number generator, ensuring the exact same mask sequence is generated each time with identical parameters. Range is 0 to 99999999. |
transitions | INT | Yes | 1 | 1 - 20 (Step: 1) | transitions (input parameter): Defines the number of smooth transitions between different mask pattern states within the total frame count. Range is 1 to 20. |
frame_width | INT | Yes | 512 | 16 - 4096 (Step: 1) | frame_width (input parameter): Sets the width in pixels for the generated mask. Range is 16 to 4096. |
frame_height | INT | Yes | 512 | 16 - 4096 (Step: 1) | frame_height (input parameter): Sets the height in pixels for the generated mask. Range is 16 to 4096. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| mask | MASK | mask (output parameter): The primary output mask sequence, where white areas represent the target region. |
| mask_inverted | MASK | mask_inverted (output parameter): The output inverted mask sequence, where black and white areas are opposite to the primary mask. |
Usage Scenarios
In video generation or image animation workflows, you can connect the mask generated by this node to the "mask" input of a sampler to guide content generation in dynamic areas. For example, you can create a gradually spreading glow effect mask to control the appearance range and manner of new content in a video sequence, or combine it with the inverted mask output to alternately process foreground and background.
Notes
Please note that the generated mask patterns are random, but identical results can be reproduced using a fixed seed value. The fineness of the mask and computation time are affected by the "depth" parameter; higher values produce more complex patterns but may also increase processing load.
Create Magic Mask Node Source Code Link
The Create Magic Mask node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.