Parse Bounding Boxes
Turn a model's 'the cat is at (x1,y1),(x2,y2)' into real boxes
- image
- BBOX
When you ask a vision model to locate something, it often answers with coordinates in prose: "the cat is at (0.3, 0.2), (0.6, 0.5)." That's information, but it's not data. Parse Bounding Boxes regex-scrapes the numbers out of that string and returns proper BBOX objects - the same format other ComfyUI utilities use - so a text answer becomes something you can crop, mask, or feed into an inpainting pipeline.
Inputs:
- image - the
IMAGEthe boxes refer to. Needed because the output is anchored to that image's resolution. - string - the model's text output.
- relative (default true) - if the model gave coordinates as 0–1 fractions, leave it on and they're scaled to the image. Turn it off for absolute pixel values.
- corners_only (default true) - the model gave two opposite corners
(x1,y1),(x2,y2). Turn it off if the format is(x1,y1)plus a width and height instead.
Output is BBOX - a list of (x1, y1, width, height) tuples, compatible with the mtb pack's bbox type.
The catch: models aren't great at this
The honest framing from the README: both Pixtral and Llama Vision kind of work for bounding boxes but not reliably. They have some positional understanding - it does sometimes work - but don't expect Florence2-level detection. Molmo, despite being great at pointing, is notably bad at boxes. So this node is best treated as a "scrape whatever the model said into a usable form" utility rather than a detection guarantee. The regex tolerates optional brackets and parentheses, which covers most of the ways a model formats a box.
Where it fits
Generate text with a prompt like "give the bounding box of the person as (x1,y1),(x2,y2)" → string → this node → BBOX → whatever downstream consumes boxes (cropping, masking). The relative flag matters: models usually output normalized fractions, and this node converting them to pixel coordinates against your actual image is the whole point.
Install
Part of the SeanScripts pack - Manager search ComfyUI-PixtralLlamaVision, or clone the repo. No extra dependencies; it's regex plus the image dimensions. Restart after installing.
Troubleshooting
- Invalid bbox messages in the console - the node logs and skips boxes that are zero-size or exceed the image bounds. Often means the model hallucinated coordinates; try a different prompt or model.
- Nothing parsed - the string didn't match the
(x,y),(x,y)pattern. Check the raw output in a text preview first. - Boxes in the wrong place -
relativeandcorners_onlyare set wrong for what the model emitted. Match the toggles to the format.
It's a scraper, not a detector - but for the times a vision model does give you a plausible box, it turns that answer into something the rest of your graph can use.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| string | STRING | — | |
| relative | BOOLEAN | true | — |
| corners_only | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BBOX | BBOX | — |