Nodes/WAS Node Suite v3/Bounds to Mask
ComfyUI Node Runs on cloud

Bounds to Mask

A measured region becomes a mask you can work with

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Bounds to Mask
  • image_bounds
  • image
  • mask
  • MASK
width0
height0

Masks are the universal handshake in ComfyUI - inpainting reads them, compositing reads them, most of the ecosystem reads them. So when WAS Node Suite measures a region as bounds and you want to actually do something with it - mask a composite, define an inpainting area - you need those rectangles painted as pixels. Bounds to Mask does exactly that: white block on black, one mask per rectangle.

Under WAS Suite/Image/Bound, it takes image_bounds plus a way to know the frame size, and emits one MASK per bounds row. If your bounds came from a batch-measured source, each row becomes its own mask, so a bounds holding one row per image answers a mask per image - the correspondence is kept without you exploding anything.

The frame question is where beginners trip, and the node gives you three ways to answer it:

  • image - the picture the bounds were measured on. Its size becomes the mask size, and width/height are then ignored. This is the right way: wire the same image that fed Image Bounds or Image Crop by Mask and the rectangles land on exactly the pixels they name.
  • mask - a mask to take the frame from instead, for bounds that came from Mask to Bounds. Read when image is empty. It has to cover the same area as the picture the bounds were measured on.
  • width / height - only read when neither image nor mask is connected. Type the dimensions of the picture the bounds were measured on, or the rectangles land in the wrong place. It's the fallback for when you genuinely don't have the source picture on a wire, and it's where the "my mask is offset" bugs live - measure on a 1872px image, forget to type 1872, and the white blocks land scattered across the wrong canvas.

Why you'd rather have a mask than a rectangle

A rectangle is a region's address; a mask is the region as pixels you can feather, grow, blur, composite, and feed to an inpaint sampler. Turning a measured box into a mask opens up the whole mask toolkit - including masking-detection flows where you detected a subject, want to inpaint only inside it, and need a clean region mask rather than a hand-painted one. Since the mask inherits its frame from the connected image, it lines up with the original by construction, which is the property that makes "detect → mask → inpaint just that" workflows stay put.

The honest caveat: a rectangle mask is blunt - it's a hard-edged block, so it will include the box's corners even where the subject doesn't fill them. If that matters (it usually does for inpainting seams), treat this as step one and run the result through a feather or grow pass before it touches a sampler.

Installing

Part of WAS Node Suite v3 (WASasquatch/was-node-suite-comfyui), WASasquatch's MIT pack - going since 2023, over a million downloads, the long-standing home of these mask/crop utilities in ComfyUI. Runs on torch, needs no extra packages or models. Requires ComfyUI 0.14.0+ (v3 targets ComfyUI's newer node backend).

Via ComfyUI Manager, search WAS Node Suite v3, or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui

Restart ComfyUI and it shows up under WAS Suite/Image/Bound. Can't find it after install? Update ComfyUI - 0.14.0 or newer is required for the pack to register.

CategoryWAS Suite/Image/Bound

Inputs (5)

NameTypeDefaultDescription
image_boundsIMAGE_BOUNDSThe rectangles to paint, from Image Bounds, Inset Image Bounds, Mask to Bounds or Image Crop by Mask. Each row becomes its own mask, so a bounds holding a row per image answers a mask per image.
widthINT00–16384Width of the mask in pixels, read only when neither image nor mask is connected. 0 = take it from the connected picture; 1872 = an 1872px frame. Type the width of the picture the bounds were measured on, or the rectangles land in the wrong place.
heightINT00–16384Height of the mask in pixels, read only when neither image nor mask is connected. 0 = take it from the connected picture; 2272 = a 2272px frame.
imageoptIMAGEThe picture the bounds were measured on. Its size becomes the mask size and width and height are then ignored. Wire the same image that fed Image Bounds or Image Crop by Mask.
maskoptMASKA mask to take the frame from instead, for bounds measured by Mask to Bounds. Read when image is empty, and it has to cover the same area as the picture the bounds were measured on.

Outputs (1)

NameTypeDescription
MASKMASKOne mask per bounds row, white inside the rectangle and black around it, ready for a masked composite or as an inpainting region.