π Ideogram 4 JSON Swap XY Coordinates
Ideogram 4 JSON Swap XY Coordinates
- STRING
Here's a bug so specific it deserves its own node. Ideogram 4's JSON prompt format expects bounding boxes in [y_min, x_min, y_max, x_max] order. Some vision models - the README calls out Qwen-9B by name - stubbornly ignore the system instruction and emit [x_min, y_min, x_max, y_max] instead. One swapped axis, and your carefully composed layout comes back rotated 90 degrees. Ideogram 4 JSON Swap XY Coordinates fixes exactly that, and nothing else.
The mechanism is a targeted coordinate transplant, applied recursively. The node parses your JSON (with the same forgiving pipeline as its preview sibling - strips code fences, digs the object out of prose, uses json_repair if present), walks the whole structure looking for every bbox or bounding_box list that has exactly four numeric entries, and flips each one from [xmin, ymin, xmax, ymax] to [ymin, xmin, ymax, xmax]. Then it re-serializes the whole thing as clean, indented JSON. It only touches coordinate lists; everything else in your layout - prompts, colors, weights - passes through untouched.
Inputs and outputs
json_string- the JSON layout text, typically the output of your vision LLM.- Output:
STRING- the same JSON with every bbox's X and Y swapped.
Wire it between the LLM's output and the node that builds your Ideogram 4 prompt. If your generations come out rotated, insert this node. If they don't - and your model does respect the instruction - skip it, because applying it when not needed will rotate your correct output.
Install
It ships in KLL535/ComfyUI_Simple_Qwen3-VL-gguf, the same pack as the main Qwen node:
cd ComfyUI/custom_nodes
git clone https://github.com/KLL535/ComfyUI_Simple_Qwen3-VL-gguf
or ComfyUI Manager (search ComfyUI_Simple_Qwen3-VL-gguf), restart, F5.
The honest take
This is the narrowest node in the pack, and it knows it. It exists because "swap the numbers" is a 30-second manual fix you'd have to redo on every single generation, and because doing it by hand means re-editing JSON you can't easily see. The recursion is the quietly nice part - it catches swapped coords buried in nested structures you'd never find by eyeballing. Pair it with the pack's Ideogram 4 JSON Preview node and you get the full loop: generate JSON, swap if needed, draw the boxes to confirm, then send it to Ideogram 4. Whether you need this one at all depends entirely on which VLM you're using for layout - but if you're on a Qwen-9B and your images keep coming out sideways, it's the exact fix you were looking for.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| json_string | STRING | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | β |