Visit ComfyUI Online for ready-to-use ComfyUI environment
Facilitates cropping images based on masks for AI artists, streamlining workflow with high accuracy.
The BatchCropFromMask
node is designed to facilitate the cropping of images based on provided masks, making it an essential tool for AI artists who need to isolate specific regions of interest within their images. This node processes batches of masks and corresponding images, identifying non-zero regions within the masks to determine the bounding boxes for cropping. By doing so, it ensures that only the relevant parts of the images are retained, which can be particularly useful for tasks such as object detection, segmentation, and other image analysis applications. The node also handles cases where masks are empty, ensuring robust and error-free operation. Overall, BatchCropFromMask
streamlines the workflow of cropping images based on masks, saving time and effort while maintaining high accuracy.
This parameter expects a batch of masks, where each mask is used to identify the regions of interest within the corresponding image. The masks should be in a tensor format, and each mask should have non-zero values in the areas that need to be retained. The node will process these masks to determine the bounding boxes for cropping.
This parameter takes a batch of original images that correspond to the provided masks. Each image in this batch should align with the respective mask in terms of dimensions and content. If the number of images does not match the number of masks, the node will issue a warning and ignore the images. This parameter is optional but recommended for accurate cropping.
This parameter is a multiplier that adjusts the size of the bounding box used for cropping. By increasing this value, you can enlarge the cropped area around the region of interest, which can be useful if you need additional context around the detected objects. The default value is typically set to 1, meaning no additional scaling is applied.
This parameter controls the smoothing of the bounding box edges. A higher value will result in smoother transitions and less abrupt edges, which can be beneficial for certain applications where a more natural-looking crop is desired. The default value is usually set to a moderate level to balance between sharpness and smoothness.
This output provides the batch of images that have been cropped based on the provided masks. Each image in this batch corresponds to the region of interest identified by the respective mask, ensuring that only the relevant parts of the images are retained.
This output contains the batch of masks that have been cropped to match the regions of interest in the original images. These cropped masks can be used for further processing or analysis, as they align perfectly with the cropped images.
This output provides a single image that combines all the cropped regions from the batch into one composite image. This can be useful for visualizing the results of the cropping operation in a single view.
This output contains a single mask that combines all the cropped regions from the batch into one composite mask. This combined mask can be used for further analysis or visualization purposes.
crop_size_mult
parameter to include more context around the region of interest if needed.bbox_smooth_alpha
parameter to control the smoothness of the bounding box edges for a more natural-looking crop.{imgs_num}
) is not equal to number of masks ({masks_num}
)© Copyright 2024 RunComfy. All Rights Reserved.