Bounded Image Crop with Mask
Crop to whatever your mask covers
- image
- mask
- IMAGE
- IMAGE_BOUNDS
This node crops an image down to the region a mask covers. Feed it a picture and a mask, and it finds the bounding box around the white part of the mask and cuts the image to that box. The WAS README sums it up as "Crop a bounds image by mask." It's the automatic version of eyeballing a crop - instead of typing coordinates, you let the mask define where the interesting stuff is.
Why this matters: detail work loves crops. If you want to inpaint a face, refine a hand, or upscale just one object, doing it on the full image wastes resolution and compute on pixels you don't care about. Crop to the masked region, process at full quality on just that patch, then paste it back. This node is the "crop to the region" step of that classic detail-pass pattern, and it plays with the rest of WAS's Bounds family (Image Bounds, Inset Image Bounds, Bounded Image Blend with Mask) that handle the paste-back side.
How it works
A mask marks a region in white. This node computes the tightest rectangle that contains that white region and crops the image to it. So a mask that's a blob in the corner yields a small corner crop; a mask spanning the frame yields a near-full crop. The output is a smaller image containing just the bounded area - higher effective resolution for whatever you do next, because all your pixels are now spent on the part you care about.
The inputs and outputs that matter
- The image in - the full picture.
- The mask in - defines the region; its white area sets the crop bounds.
- The cropped image out - just the bounded region, ready for an inpaint, an upscale, or a detailer pass.
I'm describing this from the README's stated behavior rather than a formal schema, so I won't invent exact padding-widget names or every output port - but the image-plus-mask-in, cropped-region-out shape is the node's whole job.
How to install it
Part of the WAS Node Suite:
- ComfyUI Manager: search was-node-suite-comfyui, install, restart.
- Manually:
cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui/, thenpip install -r requirements.txtagainst your ComfyUI Python, and restart.
Pure geometry - no model download.
Common issues
The thing to plan for is the round trip. Cropping is easy; pasting the processed crop back into the original at the exact right spot is where people get stuck. Keep track of the bounds so you can composite the result back - WAS's bounded-blend nodes exist precisely for this, and they blend rather than hard-paste so the seam doesn't show. If you crop, process, and then can't line the patch back up, you skipped the bookkeeping the Bounds family is designed to carry.
Second: a messy mask makes a messy crop. If your mask has stray white specks far from the main region, the bounding box balloons to include them and your crop is way bigger than you wanted. Clean the mask first (dominant-region or a threshold pass) so the bounds hug the real target. And a mask smaller than you think can crop too tight and clip the edges of your subject - pad the region a little if the important content is right at the mask boundary.
And the pack caveat: WAS Node Suite has been retired since December 2023, still everywhere but unmaintained. If a ComfyUI update makes every WAS node vanish with an "Import Failed", that's suite-level dependency drift - re-run requirements.txt against the correct Python environment (or the bundled install.bat) and restart.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | The images to cut down. The box is measured on the mask and then sliced straight out of the image, so an image that is not the same size as its mask crops in the wrong place. | |
| mask | MASK | Marks the area to keep. The box is the tightest rectangle around everything non-black in it. An entirely black mask marks nothing, and that frame falls back to its whole picture with a note in the console rather than stopping the run. One mask per image crops each one separately; any other count uses the first mask for every image. | |
| padding_left | INT | 640–18446744073709550000 | Extra pixels kept to the left of the marked area, stopping at the edge. 0 crops tight against the mask. |
| padding_right | INT | 640–18446744073709550000 | Extra pixels kept to the right of the marked area. |
| padding_top | INT | 640–18446744073709550000 | Extra pixels kept above the marked area. |
| padding_bottom | INT | 640–18446744073709550000 | Extra pixels kept below the marked area. Padding gives an inpainting pass some of the surroundings to match against. |
| return_listopt | BOOLEAN | false | Return the crops as a list of separate images rather than one batch. Needed when the masks differ per image, because crops of different sizes cannot be stacked into a batch, and only nodes that accept a list can read the result. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | The cropped regions, as a batch or as a list depending on return_list. |
| IMAGE_BOUNDS | IMAGE_BOUNDS | One row per cropped image giving the box it was taken from, to wire into Bounded Image Blend with Mask so the result goes back in the same place. |