Skip to main content
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

ParameterDescriptionData TypeRequiredRange
imageThe input batch of images to crop.IMAGEYes-
bboxesThe list of bounding boxes defining the regions to crop. This input is forced, meaning it must be connected.BOUNDINGBOXYes-
output_widthThe width each crop is resized to (default: 512).INTNo64 - 4096
output_heightThe height each crop is resized to (default: 512).INTNo64 - 4096
paddingExtra padding in pixels added on each side of the bounding box before cropping (default: 0).INTNo0 - 1024
keep_aspectWhether to stretch the crop to fit the output size, or pad with black pixels to preserve its aspect ratio (default: “stretch”).COMBONo"stretch"
"pad"
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 NameDescriptionData Type
imageAll cropped and resized regions, stacked into a single image batch.IMAGE
This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! Edit on GitHub

Source fingerprint (SHA-256): 7524d629e61f5af2475f819bc9431d4f4173feb5ad59f9bcf81d822330fb3e22