Create Fade Mask(CreateFadeMask)
This node sets the grayscale values (0
Create Fade Mask
The Create Fade Mask node generates a dynamic, customizable gradient mask sequence. Its core function is to create a batch composed of multiple image frames, where the grayscale value of each frame smoothly transitions based on set key points, forming a mask that changes over time (frame sequence). This mask can be directly used to control the transparency or influence area of other image processing nodes.
Node Functionality
This node calculates the pixel value for each intermediate frame by setting the grayscale values (between 0.0 and 1.0) for three keyframes: start, midpoint, and end, and by selecting different interpolation algorithms (such as linear, ease_in, ease_out, ease_in_out). It generates a NumPy array with a shape of (frames, height, width) and a data type of float32, ultimately outputting in ComfyUI's standard MASK format. When midpoint_frame is set to 0, the midpoint is automatically set to half of the total number of frames.
Node Parameter Description - Create Fade Mask
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
interpolation | COMBO | Yes | linear | "linear", "ease_in", "ease_out", "ease_in_out" | Selects the interpolation curve: linear, ease_in, ease_out, or ease_in_out, affecting the speed curve of the gradient. |
invert | BOOLEAN | Yes | False | - | Boolean switch. When set to True, the entire generated mask sequence will be inverted (i.e., 1.0 becomes 0.0, 0.5 becomes 0.5, and so on). |
frames | INT | Yes | 2 | 2 - 10000 (step: 1) | Specifies the total number of mask frames to generate, ranging from 2 to 10000, with a step of 1. This determines the length of the output sequence. |
width | INT | Yes | 256 | 16 - 4096 (step: 1) | Sets the width in pixels for the generated mask, ranging from 16 to 4096, with a step of 1. |
height | INT | Yes | 256 | 16 - 4096 (step: 1) | Sets the height in pixels for the generated mask, ranging from 16 to 4096, with a step of 1. |
start_level | FLOAT | Yes | 1.0 | 0.0 - 1.0 (step: 0.01) | Defines the global grayscale value for the first frame of the sequence, ranging from 0.0 (black) to 1.0 (white), with a step of 0.01. |
midpoint_level | FLOAT | Yes | 0.5 | 0.0 - 1.0 (step: 0.01) | Defines the grayscale value at the frame specified by midpoint_frame, ranging from 0.0 to 1.0, with a step of 0.01. |
end_level | FLOAT | Yes | 0.0 | 0.0 - 1.0 (step: 0.01) | Defines the global grayscale value for the last frame of the sequence, ranging from 0.0 to 1.0, with a step of 0.01. |
midpoint_frame | INT | Yes | 0 | 0 - 4096 (step: 1) | Specifies the frame index to be used as the gradient midpoint, ranging from 0 to 4096, with a step of 1. A value of 0 automatically uses half of the total frames. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| MASK | MASK | The output gradient mask sequence, a collection of multi-frame grayscale images, can be used to control transparency or blending effects. |
Usage Scenarios
This node is very useful in video transition or image blending workflows. For example, you can connect the generated mask sequence to nodes like VAEEncode or ImageComposite, using the gradient values of the mask to control crossfade effects between two video clips, or to gradually blend one image into another, creating smooth transitions.
Notes
Please note that this node is located in the "Deprecated" category, meaning there may be newer or better alternatives. The resolution of the output mask is limited by the width and height parameters, with a maximum of 4096x4096, and the frame count is capped at 10000.
Create Fade Mask Node Source Code Link
The Create Fade Mask node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.