Visit ComfyUI Online for ready-to-use ComfyUI environment
Extract specific rectangular regions from mask images with defined constraints and padding for precise region selection in image processing tasks.
The Mask To Region node is designed to identify and extract a rectangular region from a given mask image. This node is particularly useful for isolating specific areas within an image that meet certain criteria, such as non-empty regions. By defining constraints and padding, you can control the size and shape of the extracted region, ensuring it fits your requirements. This functionality is essential for tasks that require precise region selection, such as object detection, image segmentation, and other image processing applications. The node simplifies the process of converting complex mask shapes into manageable rectangular regions, making it easier to work with specific parts of an image.
The mask
parameter is the input image that contains the mask from which you want to extract a rectangular region. This parameter is essential as it defines the area of interest within the image.
The padding
parameter allows you to add extra space around the extracted region. It is an integer value with a default of 0, a minimum of 0, and a maximum defined by VERY_BIG_SIZE
. Adding padding can help ensure that the region includes some context around the masked area.
The constraints
parameter defines how the aspect ratio and dimensions of the extracted region should be handled. It offers options such as keep_ratio
, keep_ratio_divisible
, multiple_of
, and ignore
. These options help maintain the desired proportions or dimensions of the region.
The constraint_x
parameter specifies the horizontal constraint for the region's dimensions. It is an integer value with a default of 64, a minimum of 2, and a maximum defined by VERY_BIG_SIZE
. This parameter ensures that the width of the region adheres to the specified constraint.
The constraint_y
parameter specifies the vertical constraint for the region's dimensions. It is an integer value with a default of 64, a minimum of 2, and a maximum defined by VERY_BIG_SIZE
. This parameter ensures that the height of the region adheres to the specified constraint.
The min_width
parameter sets the minimum width for the extracted region. It is an integer value with a default of 0, a minimum of 0, and a maximum defined by VERY_BIG_SIZE
. This parameter ensures that the region is not narrower than the specified width.
The min_height
parameter sets the minimum height for the extracted region. It is an integer value with a default of 0, a minimum of 0, and a maximum defined by VERY_BIG_SIZE
. This parameter ensures that the region is not shorter than the specified height.
The batch_behavior
parameter defines how the node should handle batch processing. It offers options such as match_ratio
and match_size
. This parameter ensures consistent behavior when processing multiple images in a batch.
The output parameter IMAGE
is the extracted rectangular region from the input mask. This output is an image that fits the specified constraints and includes any additional padding. It provides a manageable and precise region that can be used for further image processing tasks.
constraints
parameter to maintain the aspect ratio of the region, which can be important for tasks that require proportional dimensions.batch_behavior
to ensure consistent results across multiple images.VERY_BIG_SIZE
.VERY_BIG_SIZE
.© Copyright 2024 RunComfy. All Rights Reserved.