ComfyUI_essentials
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
MaskBoundingBox+
MaskBoundingBox+ Node Documentation
Overview
The MaskBoundingBox+ node is part of the ComfyUI Essentials collection. This node is designed to identify the bounding box of the non-zero regions within a mask, optionally applying padding and blur to the mask, and returns the cropped mask along with additional metrics such as the coordinates and dimensions of the bounding box. It also allows integration with an optional image, aligning the size of the image with that of the mask as needed.
Inputs
The MaskBoundingBox+ node accepts the following inputs:
-
Mask: This is the main input and consists of the mask image you wish to process. The mask must be in a suitable format for processing.
-
Padding: An integer value specifying the number of pixels to pad around the bounding box. This is useful if you want to extend the bounding box area around the detected mask region.
-
Blur: An integer indicating the degree of Gaussian blur to be applied to the mask. A value of
0disables blurring, whereas higher values increase the strength of the blur. -
Image (Optional): An optional image input that is aligned with the mask. If provided, the image is resized or cropped to match the mask dimensions and their bounding box.
Outputs
The MaskBoundingBox+ node produces the following outputs:
-
MASK: The processed mask, cropped to the bounding box of its content with optional padding and blur applied.
-
IMAGE: The optional input image, cropped and resized to align with the mask's bounding box.
-
X: An integer denoting the x-coordinate of the top-left corner of the bounding box.
-
Y: An integer denoting the y-coordinate of the top-left corner of the bounding box.
-
Width: An integer representing the width of the bounding box.
-
Height: An integer representing the height of the bounding box.
Usage in ComfyUI Workflows
This node is particularly useful in workflows that involve image manipulation tasks where extracting a focused region of interest is necessary. For instance, when applying effects or transformations to only a specific portion of an image, the MaskBoundingBox+ node can be utilized to automatically identify and extract that region based on mask details. This can simplify processes like compositing, region-specific adjustments, and more.
Special Features and Considerations
-
Automatic Dimension Alignment: If an optional image is provided, the node automatically aligns the dimensions of the image to match the mask. The node handles any necessary upscaling or cropping, ensuring seamless integration between the mask and the image.
-
Padding and Blur Customization: Users can control both padding and blur intensities, allowing for precise tailoring of the bounding box’s reach and the smoothness of mask edges.
-
Efficient Region Extraction: By focusing only on the non-zero areas of the mask, this node can efficiently crop and prepare regions of an image for further modifications or analyses.
When using the MaskBoundingBox+ node, consider the scale and resolution of your mask and optional image, as these will affect the output bounding box dimensions and coordinate extraction.