Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.comfy.org/llms.txt

Use this file to discover all available pages before exploring further.

This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! Edit on GitHub
The CropByBBoxes node extracts and resizes specific rectangular regions from an input image batch. It uses provided bounding box coordinates to define the area to crop from each image. The cropped regions are then resized to a specified output dimension, with options to either stretch the crop or pad it to preserve its original aspect ratio.

Inputs

ParameterData TypeRequiredRangeDescription
imageIMAGEYes-The input batch of images to crop.
bboxesBOUNDINGBOXYes-The list of bounding boxes defining the regions to crop. This input is forced, meaning it must be connected.
output_widthINTNo64 - 4096The width each crop is resized to (default: 512).
output_heightINTNo64 - 4096The height each crop is resized to (default: 512).
paddingINTNo0 - 1024Extra padding in pixels added on each side of the bounding box before cropping (default: 0).
keep_aspectCOMBONo"stretch"
"pad"
Whether to stretch the crop to fit the output size, or pad with black pixels to preserve its aspect ratio (default: “stretch”).
Note: The node processes one image frame at a time. If multiple bounding boxes are provided for a single frame, it calculates a single crop region that is the union (the smallest rectangle containing all boxes) of all provided boxes. If a calculated crop region is invalid (e.g., zero width or height), the node will create a fallback crop from the center-top of the image.

Outputs

Output NameData TypeDescription
imageIMAGEAll cropped and resized regions, stacked into a single image batch.

Source fingerprint (SHA-256): 7524d629e61f5af2475f819bc9431d4f4173feb5ad59f9bcf81d822330fb3e22