Ideogram Element Collector
The Node That Turns a Cast List Into a Composition Block
- compositional_json
- element_count
- overlap_warning
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_1throughelement_8- the element JSON strings from yourIdeogramElementBuilders.element_1is 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
backgroundblank 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_countfewer than expected? A builder upstream produced malformed JSON and got dropped. Check that builder'sbbox_previewoutput 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
IdeogramJSONValidatorbefore generation.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| background | STRING | — | |
| element_1 | STRING | — | |
| element_2opt | STRING | — | |
| element_3opt | STRING | — | |
| element_4opt | STRING | — | |
| element_5opt | STRING | — | |
| element_6opt | STRING | — | |
| element_7opt | STRING | — | |
| element_8opt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| compositional_json | STRING | — |
| element_count | INT | — |
| overlap_warning | STRING | — |