Nodes/ComfyUI-ideogram4-regional-lora/Ideogram 4 Region Preview
ComfyUI Node

Ideogram 4 Region Preview

Which box is index 1? This node draws the answer

By kat3ri·Created 6 days ago·Updated 4 days ago· 1
Ideogram 4 Region Preview
  • bboxes
  • image
  • preview
  • report
canvas_width1024
canvas_height1024
feather_cells1.00
dim_image0.45
label_scale1.0
prompt
width0
height0

Ideogram 4 Regional LoRA wants a number - region_index - and if you've ever stared at your prompt builder and wondered which box is "1", this node is the answer key. Ideogram 4 Region Preview draws every placed bounding box from your prompt's JSON, labels each one with the exact region_index the LoRA node expects, and hands you a text report on the side. It exists to kill a silent, maddening bug.

Here's the trap: the numbering is not the prompt builder's numbering. Ideogram4PromptBuilderKJ tags its boxes 01, 02, … - one-based, and counting elements that were never placed on the canvas. The LoRA node indexes only placed boxes, zero-based, in the order you drew them. If you copy the builder's tag straight into region_index, you select the wrong region and nothing tells you - your character LoRA just lands somewhere it shouldn't. This node is the part of the workflow that stops you guessing.

How it works

Feed it the same JSON string the text encoder gets - the caption JSON - and it parses every element that carries a bbox, labels it, and renders two outputs:

  • preview - an IMAGE with each region drawn and numbered.
  • report - a STRING listing each index with its pixel extent and description, so you have a copy-paste reference without squinting at the canvas.

The numbers on the preview are exactly what Ideogram4RegionalLoRA's region_index inputs expect: zero-based, placed elements only, editor order. It also draws the feather_cells reach as a dashed outline, so you can see how far the LoRA node's soft edge actually extends before you commit to a render.

The inputs

  • prompt - the Ideogram 4 caption JSON, the same string the text encoder gets. This is the primary source. (You can alternatively wire bboxes plus width/height straight from the prompt builder.)
  • image - optional: wire in your decoded render and the regions draw on top of it, which makes it obvious which box is whose. Leave it unwired and it draws on a blank canvas, which costs nothing to run.
  • canvas_width / canvas_height - the canvas size used when no image is wired (defaults 1024×1024, multiples of 16).
  • feather_cells - draw the feather reach as a dashed outline. Match it to the LoRA node's value or the dashed box is lying to you.
  • dim_image - how much to darken the wired image so the boxes read (default 0.45).
  • label_scale - text size for the labels.

Install

Same pack as the LoRA node, so if you've installed that one you're done. Via ComfyUI Manager (search "Ideogram 4 Regional LoRA") or:

cd ComfyUI/custom_nodes
git clone https://github.com/kat3ri/ComfyUI-ideogram4-regional-lora
# restart ComfyUI

No extra Python dependencies; you need a ComfyUI with local Ideogram 4 support (comfy/ldm/ideogram4/), which you obviously have if you're here.

Practical notes

The workflow pattern is: Ideogram 4 Prompt Builder KJ → this node → read the indices → type them into the Regional LoRA node. Run preview once, and the numbers become obvious.

Want to adjust boxes by dragging instead of hand-editing coordinates? Wire the JSON into Ideogram4PromptBuilderKJ's import_json with import_mode = "when empty" - it seeds the editor once, then the editor wins - drag on the canvas, and take its prompt output as the new source.

The one real footgun beyond the numbering: if you draw at one canvas size and generate at another, the pixel-space boxes re-normalize and can land off your subjects. Keep the builder's canvas and the render size consistent, and let this node's overlay show you the truth before you waste a 3-minute Ideogram 4 render on a misaligned mask.

CategoryIdeogram4

Inputs (10)

NameTypeDefaultDescription
canvas_widthINT102416–16384Canvas size when no image is wired.
canvas_heightINT102416–16384
feather_cellsFLOAT1.000–16Draw the feather reach as a dashed outline. Match the LoRA node's value.
dim_imageFLOAT0.450–0.95Darken the wired image so the boxes read.
label_scaleFLOAT1.00.4–3
promptoptSTRINGThe Ideogram 4 caption JSON. Same string the text encoder gets.
bboxesoptBOUNDING_BOX
widthoptINT00–16384
heightoptINT00–16384
imageoptIMAGEOptional render to overlay the regions on.

Outputs (2)

NameTypeDescription
previewIMAGE
reportSTRING