Get Mask Size & Count(GetMaskSizeAndCount)
This node technically accepts a tensor of type MASK as input.
Get Mask Size And Count
The Get Mask Size & Count node technically receives a tensor of type MASK as input.
The Get Mask Size & Count node is a utility tool for analyzing and passing through mask information. Its core function is to read the dimensions and count of the input mask, outputting this data as separate integers while simultaneously passing the original mask data through unchanged for use by subsequent nodes.
Node Functionality
This node technically receives a tensor of type MASK as input. It parses the shape attributes of this tensor, extracting three key dimensions: batch count, height, and width. This information is calculated as separate integers and output alongside the unmodified original mask data, thereby separating information reading from data passthrough.
Node Parameter Description - Get Mask Size & Count
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
mask | MASK | Yes | - | - | Output parameter mask: Outputs the original input mask without any modifications. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| mask | MASK | Output parameter mask: Outputs the original input mask without any modifications. |
| width | INT | Output parameter width: Outputs the pixel width of the input mask. |
| height | INT | Output parameter height: Outputs the pixel height of the input mask. |
| count | INT | Output parameter count: Outputs the batch count of the input mask. |
Usage Scenarios
In practical workflows, this node is very useful when you need to dynamically adjust parameters of other image processing nodes based on the actual dimensions of a mask. For example, you can connect its output width and height values to an image scaling node to ensure processed images align precisely with the mask; or use its output count value to control a loop node for processing a batch of masks one by one.
Notes
Please note that this node only provides information reading and passthrough; it does not perform any modification or validity checks on the mask content itself. It requires the input to be valid MASK type data; otherwise, the workflow may not run correctly.
Get Mask Size & Count Node Source Code Link
The Get Mask Size & Count node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.