Crop Data to Bounds
Crop windows and bounds rows are different units — convert between them here
- crop_data
- image_bounds
- crop_width
- crop_height
WAS Node Suite v3 speaks two dialects for "a rectangle inside an image", and they don't plug into each other. The crop nodes - Mask Crop Region, Image Crop by Mask, Image Crop Location - hand you a crop_data: the window that was cut, recorded together with the size the crop came out at. Then there's the bounds family - Image Bounds, Inset Image Bounds, Bounded Image Crop, Draw Image Bounds - which works on IMAGE_BOUNDS rows describing first and last pixel row and column. The catch: a bounds row carries no size. So when a detection pipeline hands you a crop window and you want to run the bounds tools on it, you need this little translator.
Concrete case: you mark a region with a mask, cut it out with Mask Crop Region to work on it in close-up, and now you want to draw where that region sits back on the original shot, or inset it, or crop it again with the bounds nodes. The crop node gives you a window; Draw Image Bounds and friends want bounds. Crop Data to Bounds is the adapter sitting between the two.
How it works
The crop_data input is the only one, straight from any node with a crop_data output. Out comes:
image_bounds- the window as a single bounds row, ready for Bounded Image Crop, Inset Image Bounds or Draw Image Bounds.crop_widthandcrop_height- the size the crop was recorded at, in pixels. This is the part that would otherwise be lost: because a bounds row can't carry a size, the node hands it to you on its own outputs so you can wire it beside the bounds wherever the original dimensions still matter - like resizing a reworked region before it goes back home.
One subtlety the tooltips spell out: for every crop node except the face croppers, crop_width/crop_height match the rectangle exactly. Image Crop Face and Image Crop Face (YuNet) record the padded square they emit rather than the rectangle, so there the two diverge - which is exactly why the size travels on separate outputs instead of being baked in.
The trap that bites
When a face crop finds nothing, it passes False instead of a crop window - and this node raises, because there's no rectangle to read. If you're converting a face crop's output, that empty case is a real workflow state, not a rare crash: a person who turned their head, a detection that just missed. Either guard it upstream (only run the conversion when a face was found) or keep this node fed from a mask-based crop, where you control whether a region exists. It's the one genuinely sharp edge on an otherwise boring adapter.
Installing it
Nothing special. ComfyUI Manager → search WAS Node Suite v3, or clone https://github.com/WASasquatch/was-node-suite-comfyui into custom_nodes, restart. No models, no pip dependencies - the whole bounds and crop subsystem runs on torch already inside the pack.
If the pairing of crop_data ↔ bounds still feels abstract, add Draw Image Bounds after this node and wire image_bounds into it: you'll see the rectangle land exactly where the crop came from, which makes the whole conversion click.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| crop_data | CROP_DATA | The crop window to convert, from any node with a crop_data output. Image Crop Face and Image Crop Face (YuNet) pass False here when they found no face, and that raises, since there is no rectangle to read. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image_bounds | IMAGE_BOUNDS | The window as a single bounds row, giving the first and last pixel row and column it covers, for Bounded Image Crop, Inset Image Bounds or Draw Image Bounds. |
| crop_width | INT | Width the crop was recorded at, in pixels. It matches the rectangle for every crop node but Image Crop Face and Image Crop Face (YuNet), which record the padded square they emit. A bounds row cannot carry a size, so it is given here instead. |
| crop_height | INT | Height the crop was recorded at, in pixels. Wire it beside crop_width wherever the original size is still needed, such as resizing a reworked region before it goes back. |