Visit ComfyUI Online for ready-to-use ComfyUI environment
Detect and analyze specific regions within a mask image for precise image editing and layer manipulation.
The LayerMask: MaskBoxDetect node is designed to detect and analyze specific regions within a mask image, providing valuable information about the bounding box of the detected area. This node is particularly useful for AI artists who need to identify and manipulate specific parts of an image based on mask data. By leveraging different detection methods, such as the minimum bounding rectangle, maximum inscribed rectangle, or mask area, this node offers flexibility in how the bounding box is determined. The node also allows for adjustments in the position and scale of the detected box, making it a powerful tool for precise image editing and layer manipulation.
The mask parameter is the input mask image that the node will analyze to detect the bounding box. This parameter is essential as it defines the area within which the detection will occur. The mask should be provided in a format compatible with the node's processing capabilities.
The detect parameter specifies the detection method to be used. It can take one of three values: min_bounding_rect, max_inscribed_rect, or mask_area. The min_bounding_rect method finds the smallest rectangle that can enclose the mask area, max_inscribed_rect finds the largest rectangle that can fit within the mask area, and mask_area calculates the bounding box based on the mask's area. This parameter allows you to choose the most suitable detection method for your specific needs.
The x_adjust parameter allows you to adjust the detected bounding box's position along the x-axis. It accepts integer values ranging from -9999 to 9999, with a default value of 0. This adjustment can be useful for fine-tuning the position of the bounding box to better fit your requirements.
The y_adjust parameter allows you to adjust the detected bounding box's position along the y-axis. It accepts integer values ranging from -9999 to 9999, with a default value of 0. Similar to x_adjust, this parameter helps in fine-tuning the bounding box's position.
The scale_adjust parameter allows you to scale the detected bounding box. It accepts floating-point values ranging from 0.01 to 100, with a default value of 1.0. This parameter is useful for resizing the bounding box to better match the desired dimensions.
The box_preview output parameter provides an image preview of the detected bounding box. This image helps visualize the detected area and any adjustments made to the bounding box.
The x_percent output parameter indicates the x-coordinate of the center of the detected bounding box as a percentage of the mask's width. This value helps in understanding the relative position of the bounding box within the mask.
The y_percent output parameter indicates the y-coordinate of the center of the detected bounding box as a percentage of the mask's height. This value helps in understanding the relative position of the bounding box within the mask.
The width output parameter provides the width of the detected bounding box. This value is useful for understanding the dimensions of the detected area.
The height output parameter provides the height of the detected bounding box. This value is useful for understanding the dimensions of the detected area.
The x output parameter provides the x-coordinate of the top-left corner of the detected bounding box. This value helps in positioning the bounding box within the mask.
The y output parameter provides the y-coordinate of the top-left corner of the detected bounding box. This value helps in positioning the bounding box within the mask.
detect parameter to choose the most appropriate detection method for your specific task. For example, use min_bounding_rect for tight bounding boxes and max_inscribed_rect for larger, inscribed rectangles.x_adjust and y_adjust parameters to fine-tune the position of the bounding box, ensuring it aligns perfectly with the desired area.scale_adjust parameter to resize the bounding box, making it easier to fit the detected area into your overall image composition.detect parameter.detect parameter is set to one of the supported values: min_bounding_rect, max_inscribed_rect, or mask_area.scale_adjust parameter is set to a value outside the allowed range.scale_adjust parameter is within the range of 0.01 to 100. Adjust the value accordingly to fit within this range.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.