Nodes/ComfyUI 1hewNodes/String Coordinate to BBox Mask
ComfyUI Node

String Coordinate to BBox Mask

Text coordinates straight into actual masks

By 1hew·Created about a year ago·Updated 7 days ago· 33
String Coordinate to BBox Mask
  • image
  • bbox_mask
coordinates_string
output_modemerge

The sister node to String Coordinate to BBoxes takes a different route to the same idea: instead of parsing coordinates into BBOXES objects, it renders them into actual mask tensors, sized to a reference image you provide. Text in, filled rectangles out - which means you can define regions for inpainting, regional prompting, or selective editing entirely as a string of numbers, no drawing tools involved.

What it's for

The killer use is scriptable regions. You can generate coordinate strings from another node - a detection model, a spreadsheet-style table, arithmetic - and have them become masks on the exact canvas your workflow is working with. For regional work it plays nicely with the pack's mask family: feed these masks into Mask Separate, crop nodes, or combine with subject masks via mask math.

How it works

You connect an image so the node knows the canvas dimensions, then a multiline coordinates_string. Parsing is the same forgiving routine as its sibling: brackets, parentheses, and commas are stripped, numbers are read in groups of four as x1, y1, x2, y2. Each box is clamped to the image bounds (so a box hanging off the edge gets trimmed, not discarded) and drawn as a solid 1.0 rectangle into a mask the size of the image.

output_mode controls the batch shape:

  • merge (default) - all boxes drawn into one mask per input image. One frame, all regions.
  • separate - one mask per box, per image frame. You get a batch where each frame is a single rectangle, which is what you want if each region gets processed independently.

Empty or unparseable input returns an all-zero mask instead of erroring - the "no regions found" signal.

The inputs that matter

  • image (IMAGE) - sets the canvas dimensions the masks are drawn on.
  • coordinates_string (STRING, multiline) - the boxes, four numbers each.
  • output_mode - merge or separate.

One output: bbox_mask (MASK).

Installing it

ComfyUI Manager → search ComfyUI-1hewNodes → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

Restart ComfyUI. No model downloads - pure tensor drawing. The pack's requirements pull heavy packages regardless (rembg, ultralytics, etc.), and it targets ComfyUI's newer comfy_api.latest API; update ComfyUI if nodes don't register.

Common issues

The coordinate order and origin matter here more than in the BBOXES version because you're drawing pixels: x is the horizontal axis, y the vertical, and coordinates are in pixels relative to the image you connected. A common mistake is feeding coordinates from a different resolution image - the boxes are drawn at the connected image's size, so mismatched coordinate spaces land in the wrong place. Also note boxes are drawn as hard-edged solid rectangles: if you wanted feathered or blurred region boundaries, that's a follow-up step, not something this node does. And separate mode with many boxes can produce a big batch - each box is its own frame, so N boxes on a 4-frame image is 4N masks out.

Category1hewNodes/conversion

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
coordinates_stringSTRING
output_modeCOMBOmerge2 options: separate, merge

Outputs (1)

NameTypeDescription
bbox_maskMASK