- image
- IMAGE
Adjust Crop trims the dead space off an image - the white margins, the transparent border - and hands back just the content. It's the "auto-trim to the subject" node you reach for when something upstream left a bunch of empty canvas around what you actually care about.
Why you'd reach for it
The most natural spot for this is right after background removal. You run rembg or BiRefNet, get a subject floating on a transparent field, and now there's a fat cushion of nothing around it. Adjust Crop finds the subject's bounding box and cuts to it, so your product shot, character cutout, or logo comes out tightly framed instead of adrift in a mostly-empty PNG. Same deal for the white-margin version: scanned art, generated images with a pale border, anything sitting on a white background you'd otherwise crop by hand in an editor. This does it in the graph, deterministically, on every image in a batch.
It's a utility, not a headline feature - but tight framing matters more than it sounds. Downstream nodes that resize or composite behave a lot better when the input is the subject and not the subject plus a lake of whitespace.
How it works
It scans for pixels that count as "empty" - bright ones for white mode, alpha-zero ones for transparent mode - figures out the smallest rectangle that still contains everything that isn't empty, and crops to it. Padding, if you ask for it, gets added back around that rectangle so the subject isn't cut flush to the edge. Straightforward bounding-box logic; the only real judgment is where you set the "this counts as white" line.
The inputs that matter
- threshold - the brightness cutoff for what reads as white, 0.0 to 1.0, default 0.95. High on purpose: only near-pure-white gets trimmed. Drop it and you start eating light-but-real parts of your image, which is exactly the trap below.
- mode -
white,transparent, orboth(defaultboth).bothis the safe catch-all; pick a specific one when you know what kind of border you've got and don't want the other kind touched. - padding - extra pixels kept around the crop, default 0. Bump it to 8–32 if flush-to-the-subject framing feels claustrophobic or if a later step wants a little breathing room.
Output is a single IMAGE - the cropped result.
Installing it
ComfyUI Manager, search "ComfyUI Unusual Tools," install, restart. Or clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/Diohim/ComfyUI-Unusual-Tools
No models, no extra dependencies. It shows up under image/transform.
Where people get tripped up
Two things bite. First, threshold: set it too low and the node treats bright regions of your actual subject - a white shirt, a sky, a glossy highlight - as background and crops straight into them. If it's eating content, raise the threshold toward 1.0, not lower it. The 0.95 default is conservative for a reason.
Second, transparent mode needs an actual alpha channel to work with. A flat RGB image doesn't have one, so transparent has nothing to detect and effectively does nothing - if you're trimming a background-removal output, make sure the transparency actually survived into this node rather than getting flattened onto white somewhere upstream. When in doubt, both covers you: it'll trim on whichever signal is present. And if the crop looks too tight against the subject, that's what padding is for.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | FLOAT | 0.950–1 | — |
| padding | INT | 00–512 | — |
| mode | COMBO | both | 3 options: white, transparent, both |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |