JB · Ideogram Box Jitter
Vary an Ideogram-4 layout per seed — move and resize boxes without redrawing
- caption_json
One layout in KJNodes' Ideogram 4 Prompt Builder produces one composition. If you want twenty variations of that composition - the same boxes, nudged around, some bigger, some stretched - you'd normally redraw the layout twenty times. FVM_Ideogram_BoxJitter is the node that does it by seed instead. It takes an Ideogram-4 caption JSON and perturbs every box's bbox: move its center, scale it, stretch its aspect ratio - always clamped to stay fully inside the 0–1000 frame. Change the seed, get a different but coherent layout. Same seed, identical layout, every time.
It slots into the JB + Ideogram pipeline as the variation stage, and it must run before the Assembler (which rewrites each box's desc with prose). The jitter only touches the normalized bbox coordinates - it never modifies the description text - so pixel-space consumers are unaffected and you can feed the output straight into the Assembler.
How the rules work
All jitter amounts live in the jitter_rules JSON (owned by a hidden widget - you edit it in the node):
{
"default": {"pos": 0.06, "size": 0.12, "aspect": 0.08, "min": 0.03},
"overrides": []
}
pos- how far the box center can move, as a fraction of the frame. 0.06 = up to 6% of the frame in either axis.size- uniform scale around 1.0. 0.12 = each box can grow or shrink by up to 12%.aspect- independent width/height stretch on top of the uniform scale.min- the smallest a box edge can get, as a fraction of the frame. The collapse guard that stops a jittered box from turning into a sliver.
The overrides array is where it gets surgical. Each entry names one or more boxes (matched by the slot-key in their desc, comma or space separated) and replaces the default amounts for just those boxes - set a slot's amounts to 0 to pin a box perfectly still while everything else moves. Last matching override wins. So you can freeze the character box, jitter only the logo box, and let everything else drift.
Inputs and output
Inputs: jitter_rules (the JSON above), caption_json (the KJ prompt output), and seed. Output: a single caption_json with the perturbed boxes - wire it into FVM_Ideogram_Assembler. Nothing else to it.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools
No extra dependencies. Requires KJNodes for the Ideogram 4 Prompt Builder upstream. Restart ComfyUI after cloning.
Where it bites
The clamp is your friend, but it's also the thing that makes variations boring if you push too hard. Crank pos to 0.2 and most boxes slam into the frame edge and stay there - you've effectively shrunk your variation space, not grown it. Keep the defaults (0.06/0.12/0.08) as a sanity baseline and adjust one axis at a time. And remember the matching caveat: overrides match boxes by the key in their desc, so this node must run while the keys are still there - after the Assembler has replaced descs with prose, there's nothing left to match on.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| jitter_rules | STRING | {"default": {"pos": 0.06, "size": 0.12, "aspect": 0.08, "min": 0.03}, "overrides": []} | — |
| caption_json | STRING | Ideogram-4 caption JSON (KJ `prompt` output). | |
| seed | INT | 00–18446744073709550000 | Same seed + same rows → identical layout variation. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| caption_json | STRING | — |