🍒BoundingBox_Cropper✀边界框裁剪
Give it boxes, get every crop back
- image
- bboxes
- IMAGE
Once you've detected a bunch of objects in an image - faces, people, whatever - the next job is usually "cut them all out so I can process each one." BoundingBox_Cropper is the KimNodes tool for that: it takes an image and a set of bounding boxes and returns the crops, either one by index or all of them at once.
The key word in that sentence is "BBOXES." This node doesn't run any detection itself - it's a pure crop utility that consumes boxes someone else produced. And here's the wiring gotcha that trips people up on day one: it expects the BBOXES input type, which is not what the pack's own YOLO_Crop emits (that node outputs DATA). BBOXES is the box format used by the Impact Pack detector family and similar detection nodes. So this node is effectively a bridge between a detector that outputs BBOXES and whatever downstream processing you're doing - not a companion to the pack's own YOLO nodes.
How it works
You feed it an image, bboxes, and a bbox_index. The magic value is -1: set that and the node outputs every detected box's crop as a list (the node marks its IMAGE output as a list, so downstream list-aware nodes can iterate). Any other index crops just that one box, clamped to the image bounds and falling back to the first box if your index is out of range. Images with no boxes return the original unchanged - no crash, just no crop.
It also handles batches: if you feed multiple images, it uses the corresponding bbox set per frame (min(i, len-1) guards against short lists).
The inputs that matter
image- the IMAGE to crop from.bboxes- the BBOXES list. This is the type that matters; see the wiring note above.bbox_index--1= crop everything,0= first box, etc.
Output: IMAGE as a list of crops (when index is -1). Feed that into a batch-capable node, or use an Image List iterator if your downstream expects single images.
Installation
Standard KimNodes pack install - ComfyUI Manager → search "ComfyUI_KimNodes" → Install → Restart, or:
cd ComfyUI/custom_nodes && git clone https://github.com/wjl0313/ComfyUI_KimNodes
No extra dependencies - pure torch/numpy.
Common issues
- "I get no crops / the image comes back whole" - you're almost certainly not actually feeding BBOXES. Double-check the source node: it must output the
BBOXEStype. ADATAor a plain list won't connect or will be read as empty. - Index out of range - the node silently clamps to the first box rather than erroring. If you always get the same crop, your index is past the end.
- Crops look oddly trimmed - the node clamps coordinates to the image edges, so boxes that hang off the edge get cut, not padded.
It's a utility, not a headline - the kind of node that makes sense to keep installed because every detection workflow eventually needs "cut these all out." Just make sure the detector feeding it speaks BBOXES.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| bboxes | BBOXES | — | |
| bbox_index | INT | 0-1–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |