Visit ComfyUI Online for ready-to-use ComfyUI environment
Automated image cropping based on masks for precise region isolation and artistic flexibility.
The LayerUtility: CropByMask node is designed to crop an image based on a provided mask, allowing you to isolate and work with specific regions of an image. This node is particularly useful for AI artists who need to focus on certain parts of an image without manually selecting the area. By using a mask, you can automate the cropping process, ensuring precision and saving time. The node supports various detection methods to determine the cropping area, such as minimum bounding rectangle and maximum inscribed rectangle, providing flexibility depending on your needs. Additionally, it allows for reserves around the detected area and can round the crop dimensions to specific multiples, making it highly adaptable for different artistic requirements.
The mask
parameter is a required input that defines the area of the image to be cropped. It is typically a binary or grayscale image where the region of interest is highlighted. The mask helps the node determine which part of the image to focus on, ensuring that only the desired area is cropped.
The x
parameter specifies the horizontal starting point of the crop. It is an integer value with a default of 0, a minimum of 0, and a maximum defined by the maximum resolution of the image. Adjusting this value shifts the crop area horizontally.
The y
parameter specifies the vertical starting point of the crop. It is an integer value with a default of 0, a minimum of 0, and a maximum defined by the maximum resolution of the image. Adjusting this value shifts the crop area vertically.
The width
parameter defines the width of the crop area. It is an integer value with a default of 512, a minimum of 1, and a maximum defined by the maximum resolution of the image. This parameter controls how wide the cropped section will be.
The height
parameter defines the height of the crop area. It is an integer value with a default of 512, a minimum of 1, and a maximum defined by the maximum resolution of the image. This parameter controls how tall the cropped section will be.
The MASK
output parameter returns the cropped mask. This output is a subset of the original mask, resized and repositioned according to the specified input parameters. It allows you to use the cropped region for further processing or analysis.
min_bounding_rect
, max_inscribed_rect
, etc.) to see which one best suits your image and artistic needs.x
, y
, width
, and height
parameters to ensure they fall within the image's dimensions.min_bounding_rect
, max_inscribed_rect
, etc.) and correct any typos.© Copyright 2024 RunComfy. All Rights Reserved.