Create Shape Mask On Path(CreateShapeMaskOnPath)
This node determines the center position of each shape by parsing the input JSON-formatted coordinate string, and draws them on a canvas of specified width and height based on the user-selected shape type (circle, square, triangle) and size parameters.
Create Shape Mask On Path
The Create Shape Mask On Path node determines the center position of each shape by parsing the input JSON-formatted coordinate string. It then draws the shapes on a canvas of specified width and height based on the user-selected shape type (circle, square, triangle) and size parameters.
The Create Shape Mask On Path node is used to batch-generate masks of specific shapes along a specified path on a canvas. It receives a series of coordinate points, draws preset geometric shapes at each point, and ultimately outputs the corresponding mask image and its inverted version.
Node Functionality
This node determines the center position of each shape by parsing the input JSON-formatted coordinate string. It then draws the shapes on a canvas of specified width and height based on the user-selected shape type (circle, square, triangle) and size parameters. It supports batch processing, allowing for the generation of multiple masks at once, and optionally scales each shape independently via a size multiplier.
Node Parameter Description - Create Shape Mask On Path
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
shape | COMBO | Yes | circle | "circle", "square", "triangle" | The type of shape to draw: circle, square, or triangle. |
coordinates | STRING | Yes | - | - | coordinates (input parameter): Input a JSON-formatted string defining an array of coordinates for the center point of each shape, e.g., [[x1,y1], [x2,y2]]. |
frame_width | INT | Yes | 512 | 16 - 4096 (step: 1) | frame_width (input parameter): Sets the width of the output mask canvas. Valid range is 16 to 4096. |
frame_height | INT | Yes | 512 | 16 - 4096 (step: 1) | frame_height (input parameter): Sets the height of the output mask canvas. Valid range is 16 to 4096. |
shape_width | INT | Yes | 128 | 8 - 4096 (step: 1) | shape_width (input parameter): Sets the width of the drawn shape. Valid range is 8 to 4096. |
shape_height | INT | Yes | 128 | 8 - 4096 (step: 1) | shape_height (input parameter): Sets the height of the drawn shape. Valid range is 8 to 4096. |
size_multiplier | FLOAT | No | [1.0] | - | - |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| mask | MASK | mask (output parameter): The output mask image, where the shape area is white. |
| mask_inverted | MASK | mask_inverted (output parameter): The output inverted mask image, where the shape area is black. |
Usage Scenarios
This node is suitable for workflows that require creating precise masks for multiple specific areas. Examples include tracking and marking the positions of moving objects in video frames, or generating local processing regions for a series of points of interest (such as faces, buildings) in a large image. Users can directly input dynamically acquired coordinate data (e.g., from other analysis nodes) to automate the generation of mask sequences.
Notes
Please note that this node has been marked as "deprecated," meaning it may be removed or replaced by a node with superior functionality in future versions. The input coordinate string must be in strict JSON array format, e.g., [[100,200], [300,400]], otherwise it will cause a runtime error.
Create Shape Mask On Path Node Source Code Link
The Create Shape Mask On Path node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.