Bbox_BboxToStr
Turn a bounding box into a portable text coordinate
- image
- bbox
- normalized_str
- mask
Bounding boxes in ComfyUI are usually a black box between two nodes - a detector spits one out, an inpaint node consumes it, and you never see the numbers. Bbox_BboxToStr breaks that opacity on purpose: it takes a BOUNDING_BOX and turns it into a plain, normalized text string you can read, save, hand-edit, or pipe into something that only speaks text (a JSON export, a prompt, a log).
Why you'd want this
The 2026-era inpainting workflow the wider ComfyUI community has settled into is "ground it with a VLM, derive the mask from the bbox" - point a vision-language model at an image, ask it to name and locate an object, get back a box, and use that box instead of painting a mask by hand. That pipeline lives and dies on bounding boxes being something you can pass around as text, because a lot of vision-language models emit coordinates as strings, not as ComfyUI's internal box type. Bbox_BboxToStr is the export half of that bridge - take a box you already have (from a detector node, or hand-drawn) and serialize it so it can travel outside the graph or get logged for later reuse.
Inputs and outputs
Deliberately minimal:
image(required) - the image the box was detected on. Needed so the coordinates can be normalized relative to that image's dimensions rather than expressed as raw pixels tied to one specific resolution.bbox(required,BOUNDING_BOX) - the box itself, coming from whatever detector or manual-box node produced it.
Outputs:
normalized_str- the box as a text string, using normalized (0–1) coordinates rather than pixel values. That's the deliberate choice: a normalized string stays valid if you later run the same workflow on a differently-sized image, where raw pixel coordinates wouldn't.mask- the same region, rendered as aMASKyou can feed straight into an inpaint sampler.
Its sibling node, Bbox_strToBbox, does the reverse - parses a coordinate string (either this node's normalized format, or a separate per-mille format meant for AI-generated output) back into a real BOUNDING_BOX. Between the two you can round-trip a box out to text and back, which is the whole point if something in the middle of your pipeline needs to touch it as a string.
Installing it
Through ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
then run install.bat on Windows to install dependencies, restart ComfyUI. This particular node has no model or heavy dependency of its own - it's coordinate math, nothing more.
Common issues
You get a string but nothing seems to read it. normalized_str is plain text by design - it won't auto-wire into anything expecting BOUNDING_BOX. You need Bbox_strToBbox (or your own text handling) on the other end if you want it back as a usable box.
The mask looks right but is offset after resizing the image. Because the string is normalized to the image passed into this node, feeding a resized or cropped version of the same image into a downstream node before converting back will shift the box. Keep track of which image the box was normalized against, and pass the matching image into Bbox_strToBbox when you convert it back.
No box was detected upstream and this node errors. bbox is a required input - there's no optional fallback here. If your detector can return "nothing found," gate this node behind a check (or accept the run failing on empty detections) rather than expecting it to pass through gracefully.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| bbox | BOUNDING_BOX | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| normalized_str | STRING | — |
| mask | MASK | — |