ComfyUI Node

Ideogram Element Builder

One Bounding Box, One Palette, One Piece of the Scene

By SurrealByDesign·Created 2 months ago·Updated 2 months ago· 3
Ideogram Element Builder
    • element_json
    • bbox_preview
    element_typeobj
    description
    bbox_ymin0
    bbox_xmin0
    bbox_ymax500
    bbox_xmax500
    color_palette
    text_content

    Ideogram 4's regional control works through compositional_deconstruction: you describe the scene as a list of elements, each with its own bounding box, its own description, and optionally its own color palette. It's the closest thing open-weights has to genuine spatial prompting - boxes can even overlap and nest - but writing one by hand means getting nested JSON, [ymin, xmin, ymax, xmax] ordering, and palette limits right by memory. IdeogramElementBuilder builds one of those elements from plain inputs, no JSON in sight.

    The node's purpose is narrow and it's honest about it: you wire several builders in parallel, each describing one region of your scene, and feed them into IdeogramElementCollector, which assembles the full block. Think of it as one slot in a cast list.

    What you set

    • element_type - obj or text. Default obj. Choose text when the element is in-image text (an Ideogram specialty), and fill in text_content - it's ignored when the type is obj.
    • description - what the element is. "red sports car," "neon sign reading OPEN," whatever belongs in that box.
    • The four box edges: bbox_ymin, bbox_xmin, bbox_ymax, bbox_xmax - INTs, 0 to 1000. Note the order: it's [ymin, xmin, ymax, xmax], which is the official Ideogram element schema order and not the [x, y, x, y] you might expect from other tooling. This is the single most common confusion point, so the pack's README calls it out in bold.
    • color_palette (optional) - a hex-array JSON string, max 5 colors. Wire IdeogramElementPalette (or IdeogramMaskedPaletteExtractor clamped to 5) into this to give the region its own reference colors.

    Outputs: element_json (one element object, ready for the collector) and bbox_preview (a human-readable summary plus any warnings - handy for catching a bad box before it reaches the collector).

    The guardrails are the selling point

    Box edges get clamped to 0–1000, inverted edges (ymax below ymin) get swapped instead of producing nonsense, and a malformed palette is dropped with a warning rather than crashing. Those aren't flashy features, but they're exactly what you want when you're dragging boxes around numerically. The defaults (0, 0, 500, 500) describe the top-left quarter of the canvas, which is a sensible starting box to nudge.

    Installing it

    Part of the pack - one install, fifteen nodes. ComfyUI Manager: search "Ideogram Palette and Prompt Tools". Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SurrealByDesign/ComfyUI-Ideogram-Palette-and-Prompt-Tools
    

    Restart ComfyUI. Only extra dependency: scikit-learn (Manager auto-installs it; otherwise pip install scikit-learn). torch/numpy/Pillow deliberately not pinned. Nodes under Ideogram/Palette, Python ≥ 3.10, tested on ComfyUI 0.24.0 / Python 3.12.

    Gotchas and troubleshooting

    • [ymin, xmin, ymax, xmax], seriously. If your elements land in the wrong place, you reversed the axis order. It's the top mistake people make with this schema.
    • Text elements want text_content. A text element with an empty text_content gets a placeholder in the source - fill it or your in-image text comes out blank.
    • Palette too long? It's capped at 5 and excess is silently trimmed (or dropped if malformed). Use IdeogramElementPalette upstream so you never fight this.
    • A single builder isn't a prompt. It outputs one element; you still need the collector (and then the prompt assembler / validator) to produce something Ideogram will accept. Don't wire element_json into a generation node expecting a full prompt.
    CategoryIdeogram/Palette

    Inputs (8)

    NameTypeDefaultDescription
    element_typeCOMBOobj2 options: obj, text
    descriptionSTRING
    bbox_yminINT00–1000
    bbox_xminINT00–1000
    bbox_ymaxINT5000–1000
    bbox_xmaxINT5000–1000
    color_paletteoptSTRING
    text_contentoptSTRING

    Outputs (2)

    NameTypeDescription
    element_jsonSTRING
    bbox_previewSTRING