Crop by BBox
Apply one exact crop box across a whole frame batch
- frames
- alpha
- cropped_frames
- cropped_alpha
- width
- height
Crop by BBox takes a batch of frames and a bounding box, and crops every frame to that exact box - same rectangle, applied consistently across the whole batch, with control over what fills the space if the box runs off the edge of a frame. Its natural partner in this pack is Auto Cropper, which detects a bounding box and hands it out as a string; this node is the other half, the one that applies a box you already have. Run detection once, reuse the same box across a full-resolution pass, a second batch, or a re-render, without paying the detection cost again.
How it works
Give it a batch and a box (as a string, wired in from something like Auto Cropper, or typed by hand) and it crops every frame identically. Where the box overlaps real image content, you get real pixels; where it doesn't - because your subject moved, or the box you're reusing came from a different frame - the gap gets filled with your padding settings instead of just erroring out.
The inputs and outputs that matter
frames(IMAGE, required) - the batch to crop.padding(INT, default0, 0–500) - extra margin added around the box.padding_color(STRING, default#000000) - the fill color for padding that falls outside the actual frame.use_image_padding(BOOLEAN, defaultfalse) - the author's own note on this one: "If true, padding area is taken from the original frame when in bounds; out-of-bounds area uses padding_color." So turning it on prefers real image content for padding wherever the frame actually has it, and only falls back to your solid color where there's nothing there to grab.bbox(STRING, optional) - the box itself. This is the field that pairs with Auto Cropper'sbboxoutput.alpha(MASK, optional) - crop the alpha channel alongside the image so it stays aligned.
Four outputs: cropped_frames (IMAGE), cropped_alpha (MASK), width (INT), height (INT) - the last two save you a separate "get image size" node downstream.
How to install it
ComfyUI Manager, search "Link Comfy Nodes." Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Mister-Link/link-comfy-nodes
pip install -r link-comfy-nodes/requirements.txt
Restart ComfyUI when done.
Common issues & troubleshooting
Not knowing what format the bbox string should be. This node isn't meant to be hand-typed most of the time - its real job is consuming the exact string Auto Cropper emits. If you're constructing one yourself and getting unexpected crops, feed an Auto Cropper output through once first and inspect what it actually produces before trying to hand-author your own.
Box drifts off frame on later frames of a batch. Because the same box is applied to every frame identically, a box detected from one frame (or one pass) can miss the subject entirely a few dozen frames later if there's real motion. That's exactly what padding_color and use_image_padding are for softening - but if drift is severe, you likely need per-frame detection (Auto Cropper run properly across the batch) rather than one static box.
Alpha and frame count mismatch. If you connect alpha, make sure it has the same batch length as frames - a mask batch built from a different step in your pipeline is an easy way to end up with misaligned crops between the image and mask outputs.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| frames | IMAGE | — | |
| padding | INT | 00–500 | — |
| padding_color | STRING | #000000 | — |
| use_image_padding | BOOLEAN | false | If true, padding area is taken from the original frame when in bounds; out-of-bounds area uses padding_color. |
| bboxopt | STRING | — | |
| alphaopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| cropped_frames | IMAGE | — |
| cropped_alpha | MASK | — |
| width | INT | — |
| height | INT | — |