String Coordinate to BBoxes
Paste coordinates as text, get real BBOXES out
- bboxes
Some workflows hand you coordinates as plain text - a detection script that printed x1 y1 x2 y2, a table of boxes you're typing by hand, an API response full of bracket-wrapped numbers. ComfyUI's segmentation and regional nodes don't want text, they want BBOXES, and that's the gap String Coordinate to BBoxes fills: text coordinates in, proper bbox objects out, ready to wire into SAM2 or any regional node that speaks BBOXES.
What it's for
This is a converter for the "I have numbers, they need to become structure" moment. The main consumer is SAM2-based workflows - the README calls out SAM2 compatibility explicitly - plus any node that takes bounding boxes for regional prompting or targeted editing. You get to author or edit boxes as plain text in a multiline field, which is a lot easier to reason about than dragging invisible widgets, and you can generate those strings from other nodes and pipe them straight in.
How it works
The parser is deliberately forgiving. It strips out brackets, parentheses, and commas - [10, 20, 110, 220], (10 20 110 220), or a bare 10 20 110 220 all parse the same - then reads the numbers in order, grouping every four into one bbox as x1, y1, x2, y2. Format chaos is absorbed before the numbers ever get parsed.
The output is the shape SAM2-family nodes expect: a list of bboxes, one per region, in the nested format those nodes consume. If you feed garbage or nothing, you get an empty bbox list back rather than a crash - which is the right failure mode for a node that's often driven by model output that might be empty.
The inputs that matter
- coordinates_string (STRING, multiline) - your coordinates, in any reasonable arrangement of numbers, four per box.
One output:
- bboxes (
BBOXES) - the parsed boxes.
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 models, no downloads - pure parsing. Pack-level notes: requirements pull heavy deps anyway (rembg, ultralytics, transformers), and the pack uses ComfyUI's newer comfy_api.latest API, so update ComfyUI if the nodes don't appear.
Common issues
The parser treats every four numbers as a box, so a stray extra number silently shifts the grouping - if you pasted a 5th value by mistake, everything after it pairs wrong. Validate your input, because there's no error for it. It also doesn't validate that boxes fit any image, since it doesn't know the image size - if you're feeding SAM2, malformed coordinates (negative, reversed x1/x2, out-of-bounds) will be the downstream node's problem. When in doubt, keep the multiline field tidy: one box's four numbers on a line reads way better than a wall of digits.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| coordinates_string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bboxes | BBOXES | — |