ComfyUI Node

Layout

Draw boxes on a canvas and write the prompt Ideogram 4 actually understands

By Nynxz·Created 12 months ago·Updated 10 days ago· 4
Layout
  • layout
  • inputs
  • layout

Some models don't take prose. Ideogram 4 was trained exclusively on structured JSON captions - hex palettes, bounding boxes as [y_min, x_min, y_max, x_max], typed text elements for in-image text - and if you feed it a normal prompt you get a normal-prompt result, which is to say a bad one. People bounce off it convinced the model is broken.

The usual answer is a prompt builder node where you draw boxes on a canvas. This is that node, and it's from the person who wrote the one people were already recommending: Nynxz's earlier ComfyUI-IdeogramHelper was the pack you got pointed at in Ideogram threads when the built-in JSON route failed. Layout is that idea rebuilt properly, with the same canvas speaking three models' formats instead of one.

Three modes, one canvas

layout is the editor state - the canvas, its prompt, and the boxes you drew. The boxes are stored as fractions of the canvas (x, y, w, h), each with a name, a colour, an optional palette, a description, tags and a kind: object, character or text. Text boxes carry their own text string, because that's how you get specific words rendered.

mode picks who the layout gets written for:

  • ideogram - Ideogram 4's caption JSON, keys in the order it was trained on, so the schema matches rather than merely resembling it.
  • klein - FLUX 3 Image Klein: the caption, a space, then the element table.
  • moss - MOSS-Image's layout JSON, with pixel boxes measured from the canvas centre, [y, x, y, x].

Switch modes whenever you like. The boxes stay put - every mode shares the same fields and each reads only what its model knows about, so an Ideogram layout you spent ten minutes on isn't wasted when you want to try MOSS instead. That's a small design decision that saves a genuinely annoying evening.

Canvas dimensions get snapped to multiples of 16, up to 16384. Boxes cover their canvas; the ones you hide are left out of the prompt rather than deleted, which is the cheap way to A/B "was this element helping?"

What comes out

One output: layout, into Layout Extras. That's the letdown if you were expecting a prompt socket - Layout on its own gives you nothing a text encoder can eat. Extras compiles the layout into the actual prompt string, plus core-format elements, pixel boxes and an overlay. Two nodes instead of one, and it's the right split: the editor stays one wire, and you only pay for the compilation when you need it.

There's an optional inputs socket for Layout Inputs, which brings two things: a photo to trace and remix (shown in the editor after a run so you can draw over what you're actually looking at), and a vision-language model so the editor can have an agent draw boxes for you. The agent is a Qwen3-VL-8B-class encoder; it only loads when you ask it to, so wiring it costs nothing until you use it.

Layout is also flagged as an output node, which is why a queue with nothing downstream still sends the photo back to your canvas.

Install

comfy node install comfyui-nynxz-nodes

Or search Nynxz in ComfyUI Manager. From source, build the frontend - this node is a frontend:

cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-NynxzNodes
cd ComfyUI-NynxzNodes
pnpm install && pnpm build

Restart afterwards. No Python dependencies. ZenKit is optional and only adds pop-out panels, which you'll want if you're drawing on a small screen.

Where it goes wrong

Boxes that "don't work" are usually a mode mismatch: you drew for Ideogram, then loaded FLUX 3 Klein. Check the mode first - it's one click and it explains most of it.

Empty or half-empty prompt output: Layout Extras only writes boxes that are visible and have area. A box dragged to zero width vanishes from the prompt with no complaint.

And this is a prompt-format node, not a magic composition layer. It gives the model the layout in the syntax it was trained on, which is a large part of why box prompting works so well on these models - but if the boxes fight the prompt, the boxes lose. Keep the box descriptions close to what you wrote in the overall prompt.

CategoryNynxz/Conditioning/Layout

Inputs (2)

NameTypeDefaultDescription
layoutNYNXZ_LAYOUT_SCENE[object Object]—
inputsoptNYNXZ_LAYOUT_INPUTSLayout Inputs: a photo to trace and remix, and the agent's model.

Outputs (1)

NameTypeDescription
layoutNYNXZ_LAYOUTInto Layout Extras.