Convert BBox [y,x,y,x] ↔ [x,y,x,y]
One regex that fixes every axis-order fight
- converted_text
Bounding boxes are the quiet hell of region-captioning a dataset. Different tools don't just disagree about what a box means - they disagree about the order of the four numbers. CCC_BBoxConverter exists for the single most common flavor of that fight: the [y, x, y, x] crowd versus the [x, y, x, y] crowd.
Feed it any text containing 4-number bracketed lists and it rewrites every bbox from y-first to x-first (or the reverse - the swap is symmetric, so one node handles both directions). Everything else in the text passes through untouched, so you can drop it inline in a caption pipeline without worrying it'll mangle your prompt prose.
How it works
It's a regex, and it's honest about being a regex. The node scans for [a, b, c, d] patterns - four integers in square brackets - and swaps the first two and last two values, turning [y1, x1, y2, x2] into [x1, y1, x2, y2]. It doesn't try to parse JSON, it doesn't validate that the values are sane, and it can't know which convention your text is in. You have to know that yourself.
That's both the strength and the trap. The strength: it works on raw caption text, partial JSON, even a line in the middle of a paragraph. The trap: if you feed it text that's already in the order you want, it happily swaps it into the wrong order. Run it once, check the output, and don't re-run it downstream.
The input is text_input (a string, forced-input so you can wire it) and the output is converted_text. That's the entire interface - there's no format selector, because there's nothing to select. This is the one node in the bbox family where you really can't get the plumbing wrong.
Where it fits
In the Consistent Character Creator pipeline, the CCC_Ideogram4_LoRA_Tagger and the tagger-adjacent captioning emit boxes in Ideogram's [y, x, y, x] convention. If your trainer, another tagger, or a bbox-drawing reviewer expects [x, y, x, y], you put this node between them. It also pairs with CCC_BBoxAbsoluteConverter - normalize the order here first, then rescale.
One light warning from the community side: box-format fights are the single most common reason "my dataset review shows boxes in the wrong place." Before you suspect the reviewer or the trainer, confirm which axis order the tool that wrote the boxes used. This node only fixes order, not provenance.
Installing it
Ships in the Mickmumpitz-Nodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes.git
Or via ComfyUI Manager (search "Mickmumpitz"), then restart. No model downloads, no heavy dependencies - the whole pack runs on numpy, Pillow and opencv-python.
Troubleshooting
- Boxes not converted - the regex only matches
[a, b, c, d]with integers and commas. Boxes written asa,b,c,dwithout brackets, or as floats like[0.5, 0.3, ...], won't match. - Boxes converted twice - you re-ran the node (or it's in a loop). The swap is an involution; two passes undo each other.
- Decimal normalization untouched - this node only swaps order. It does not scale 0-1000 to 0-1 or pixels; that's the absolute converter's job.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text_input | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| converted_text | STRING | — |