Nodes/WAS Node Suite v3/Draw Image Bounds
ComfyUI Node Runs on cloud

Draw Image Bounds

See what a bounds row actually points at — and get the region as a mask

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Draw Image Bounds
  • image
  • image_bounds
  • IMAGE
  • MASK
color#00FF00
thickness3
fill_opacity0.00
label
label_size20
opacity1.00

An IMAGE_BOUNDS value is just numbers - rows of first and last pixel column and row describing rectangles in an image. Perfectly precise, completely invisible. If you've ever wired a bounds row into something and had zero idea whether it was pointing at the sky or the car, this node is the missing pair of eyes: it draws the rectangles on the image so you can see exactly what the bounds describe, with an optional fill, label, and a mask version of the same regions on the second output.

Its natural home is detection and region workflows. You measure a region with Image Bounds or Mask to Bounds, you maybe inset it, and now you want to check what you've got before you crop or mask through it. Draw Image Bounds turns that check into something you can actually look at, and because it also returns the drawn regions as a mask, it doubles as a cheap bounds-to-mask converter when you set it to fill.

How it works

The two required inputs are the images to draw on and the image_bounds describing the regions. Batch semantics matter here: a single image gets every row of the bounds drawn on it - which is how you see a whole set of detected regions at once - while a batch of images gets one row each, in order.

Then the styling knobs:

  • color - outline colour as #RRGGBB, #RRGGBBAA or a name. Green shows up on most photographs; magenta is the better pick over foliage, where green outlines vanish.
  • thickness - outline width in pixels. 0 draws no outline at all, which matters for the mask trick below.
  • fill_opacity - how solidly the inside is filled in the same colour. 0.0 leaves regions open, which is what an inspection overlay wants; around 0.25 tints the region while keeping the picture readable underneath.
  • label - a caption drawn in each rectangle's top-left corner. {index}, {width} and {height} expand per region, so region {index}: {width}x{height} labels a set of crops with what each will produce.
  • label_size - label text height in points; read only when a label is set.
  • opacity - fades outlines, fills and labels together, so nothing drifts out of step when you blend the overlay down.

What comes back

The first output is the IMAGE with bounds drawn over it. The second is a MASK of the rectangles - white wherever the overlay was drawn. That second output is the quietly useful one: with thickness at 0 and fill_opacity above 0, the mask becomes a solid region mask for the bounds, which turns "draw boxes so I can check my detection" into "also hand me a clean mask of everything I just checked."

Installing it and the one scaling trap

WAS Node Suite v3, nothing special: ComfyUI Manager → search WAS Node Suite v3, or clone into custom_nodes, restart. No models, no pip packages - the drawing runs on the pack's own canvas code.

The trap is thickness, which is in raw pixels: 3 is clearly visible at 1024 and essentially invisible at 4096. Scale it with your working resolution rather than leaving the default when you jump to hires work - or use the label/fill to make regions readable at any size.

CategoryWAS Suite/Image/Bound

Inputs (8)

NameTypeDefaultDescription
imageIMAGEThe images to draw on. A single image gets every row of the bounds drawn on it, which is how a whole set of detected regions is seen at once; a batch gets one row each, in order.
image_boundsIMAGE_BOUNDSThe regions to draw, from Image Bounds, Inset Image Bounds, Mask Crop Region or any other node with a bounds output.
colorSTRING#00FF00Colour of the outline, as #RRGGBB, #RRGGBBAA or a name. Green shows up on most photographs; magenta is the better choice over foliage.
thicknessINT30–256Width of the outline in pixels. Scale it with the image, 3 is clear at 1024 and invisible at 4096. 0 draws no outline, which leaves the fill as the only mark and turns the region into a solid block.
fill_opacityFLOAT0.000–1How solidly the inside of each rectangle is filled, in the same colour. 0.0 leaves it open, which is what an inspection overlay wants; around 0.25 tints the region while leaving the picture readable underneath.
labelSTRINGCaption drawn inside the top left corner of each rectangle. Empty draws none. {index} becomes the row number, {width} and {height} the size of that region in pixels, 'region {index}: {width}x{height}' labels a set of crops with what each one will produce.
label_sizeINT201–512Height of the label text in points. Read only when a label is set.
opacityFLOAT1.000–1How much of the whole overlay shows. Applied to the outlines, fills and labels together, so nothing drifts out of step when it is faded.

Outputs (2)

NameTypeDescription
IMAGEIMAGEThe images with the bounds drawn over them.
MASKMASKThe rectangles as a mask, white wherever the overlay was drawn. With thickness 0 and fill_opacity above 0 this is a solid region mask for the bounds.