Nodes/was-node-suite-comfyui/Bounded Image Crop
ComfyUI Node Runs on cloud

Bounded Image Crop

Crop an image to a computed bounding box

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Bounded Image Crop

      Bounded Image Crop is part of a small family of "bounds" nodes in WAS Node Suite that do precise rectangle math around a region of interest - usually one defined by a mask. The family works together: Image Bounds computes the tightest bounding box around a masked region, Inset Image Bounds pads or shrinks that box by a margin, and Bounded Image Crop then actually cuts the image down to that computed rectangle. There's also a Bounded Image Crop with Mask variant if you want the mask cropped identically alongside the image.

      Why this pattern exists

      This is the same underlying idea behind detect-crop-refine workflows you'll see elsewhere in the ecosystem - most famously Impact Pack's FaceDetailer, which automates detect, crop, resample-at-full-resolution, and paste-back as one node using a YOLO or SAM detector. WAS's bounds family is the older, more manual version of the same concept: instead of an automatic detector deciding what to crop, you supply the mask (from wherever - manual painting, a segmentation node, a threshold pass), compute its bounds, optionally pad it with Inset Image Bounds so you're not cropping right up against the subject's edge, and then crop with this node. It's more steps, but it's also more controllable - useful when you already have a precise mask from elsewhere and want an exact, not-detector-guessed crop region.

      What comes after

      Cropping is rarely the end goal - you crop so you can process a region in isolation (upscale it, run a fresh sampling pass on it, apply a filter) at proper resolution, then put it back. The suite's Bounded Image Blend and Bounded Image Blend with Mask nodes are the natural next step, pasting your processed crop back into the original image at the same location the bounds came from.

      Installing it

      Through ComfyUI Manager: search "WAS Node Suite", install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      cd was-node-suite-comfyui
      pip install -r requirements.txt
      

      Pure image math - nothing to download for this node.

      Troubleshooting

      If the crop comes out empty, offset, or the wrong size, the mask you fed into Image Bounds upstream is almost always the actual culprit - check that the mask is genuinely covering the region you expect before assuming this node mis-cropped it. And if the crop lands flush against your subject with no breathing room for later blending, that's what Inset Image Bounds is for - pad it before you crop, not after.

      As always in this pack: WAS Node Suite has had no active development since the author stepped back in December 2023. If this node - or the whole suite - fails to load after a ComfyUI core update, that's typically a suite-wide import failure over a stale pinned dependency (BLIP support is the recurring one), not this crop logic specifically.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs