ComfyUI Node

Ideogram Element Collector

The Node That Turns a Cast List Into a Composition Block

By SurrealByDesign·Created 2 months ago·Updated 2 months ago· 3
Ideogram Element Collector
    • compositional_json
    • element_count
    • overlap_warning
    background
    element_1
    element_2
    element_3
    element_4
    element_5
    element_6
    element_7
    element_8

    IdeogramElementBuilder produces one element at a time. IdeogramElementCollector is where they get stitched into the actual compositional_deconstruction block that Ideogram 4 consumes - the full regional prompt with a background description on top and up to eight positioned elements underneath.

    It's the "finish the sentence" node in the pack's element pipeline: builders in, complete compositional JSON out. It also solves a genuine ComfyUI gap on the way - there's no native way to collect a variable number of string outputs into one list, so this node exists partly as that plumbing.

    What you set

    • background - a plain-text description of everything that isn't an element. "A misty valley at dawn," "an empty art gallery with soft skylights." This becomes the block's background field.
    • element_1 through element_8 - the element JSON strings from your IdeogramElementBuilders. element_1 is required; the rest are optional. Wire as many or as few as your scene needs. A scene split into sky, valley, traveler, and foreground rock, each with its own box and palette, is four builders into four inputs - exactly the example the pack's README shows.

    Outputs:

    • compositional_json - the complete block, ready for the prompt assembler.
    • element_count - how many elements actually made it in (INT). Wire this to a text display if you want to verify nothing got dropped.
    • overlap_warning - a STRING, empty when all's well. It reports overlapping text element boxes, because overlapping text renders poorly in Ideogram 4 and the pack would rather tell you than let you discover it in the output.

    The robust behavior that makes it a set-and-forget node

    Empty inputs are skipped, malformed elements are dropped with a console warning instead of crashing, and the overlap check only flags text boxes (object boxes overlapping is legal and often desired in Ideogram's schema - that's how you get a character standing in front of a structure, for instance). So the collector is forgiving by design; it assumes your builders did the careful validation and it just assembles.

    Where it sits

    IdeogramElementPalette → IdeogramElementBuilder ─┐
                                         (parallel)  ├→ IdeogramElementCollector → IdeogramPromptAssembler → JSON Validator
    IdeogramMaskedPaletteExtractor → ElementBuilder ─┘
    

    The collected compositional_json merges into your base prompt via IdeogramPromptAssembler (as merge_json), and the result gets validated before it ever hits a generation node.

    Installing it

    Part of the pack. 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 (auto-installed by Manager, or pip install scikit-learn). torch/numpy/Pillow deliberately unpinned - ComfyUI ships them. Nodes under Ideogram/Palette, Python ≥ 3.10, tested on ComfyUI 0.24.0 / Python 3.12.

    Gotchas and troubleshooting

    • Background description isn't optional. Leave background blank and your composition block has a hole. Give it a real sentence; it's the anchor everything else hangs off.
    • Overlapping text warning is worth respecting. Ideogram genuinely struggles with overlapping text elements. Move the boxes or accept the risk - but it's a warning, not an error, and it won't stop the run.
    • element_count fewer than expected? A builder upstream produced malformed JSON and got dropped. Check that builder's bbox_preview output for warnings, and check the console.
    • The collector is not a validator. It'll assemble a structurally fine block from garbage descriptions. Run the finished prompt through IdeogramJSONValidator before generation.
    CategoryIdeogram/Palette

    Inputs (9)

    NameTypeDefaultDescription
    backgroundSTRING
    element_1STRING
    element_2optSTRING
    element_3optSTRING
    element_4optSTRING
    element_5optSTRING
    element_6optSTRING
    element_7optSTRING
    element_8optSTRING

    Outputs (3)

    NameTypeDescription
    compositional_jsonSTRING
    element_countINT
    overlap_warningSTRING