BBox Cropper - klinter
Crop a dozen regions from one image — and keep the labels attached
- image
- CROPPED_IMAGES
- CROPPED_LABELS
- USED_BBOXES
BBox Cropper - klinter exists for a specific, slightly nerdy job: you've got an image, you've got a list of bounding boxes with labels (from a detection model, an API, or your own hand-written list), and you want every region cut out as its own image - with the label for each crop carried along. If you've ever tried to do region crops in plain ComfyUI you know it's a pain: you either write one Crop node per box or deal with mask math. This collapses it into one node.
The inputs are image, bbox_data, and padding. bbox_data is a JSON string with the shape shown in the default: a list of objects, each with a bboxes array of [x_min, y_min, x_max, y_max] lists and a matching labels array. The node parses that JSON, crops each box out of the image, and returns the crops stacked as one IMAGE tensor plus CROPPED_LABELS and USED_BBOXES as JSON strings. padding adds a margin around each crop, clamped so it never runs past the image edges.
A few behaviors are worth knowing before you build a workflow on top of it. First, it only processes the first image in a batch - the source says so explicitly, so don't feed it a 12-frame tensor and expect 12 sets of crops. Second, all crops get padded to the same size with white so they stack cleanly into one tensor; if your crops are wildly different aspect ratios you'll get white bars, which is fine for feeding into a batch but a trap if you expected tightly-bound crops. Third, the JSON has to be real JSON - the node will hand back an empty placeholder tensor if parsing fails, which is a debugging experience best avoided by testing your string in a text editor first. Labels and boxes get trimmed to the shorter list if they don't match up.
Where people get burned: bbox_data is a string input, so whatever upstream node produces it must output JSON as text. And those boxes are x_min, y_min, x_max, y_max in pixel coordinates, not center-width-height. Get that backwards and you're cropping white space.
Install is the pack standard: search "Klinter_nodes" in ComfyUI Manager, or cd ComfyUI/custom_nodes && git clone https://github.com/klinter007/klinter_nodes and restart. No extra Python deps - just Pillow, torch, and the bundled comfy_api. Like the rest of this pack it wants a reasonably recent ComfyUI, so if it doesn't register, update the core first.
Reach for it when a detection pass hands you boxes and you need each face, object, or region as its own image with its label intact.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| bbox_data | STRING | [{"bboxes": [[10, 10, 100, 100]], "labels": ["example"]}] | — |
| padding | INT | 00–200 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| CROPPED_IMAGES | IMAGE | — |
| CROPPED_LABELS | STRING | — |
| USED_BBOXES | STRING | — |