π Z2J Composition
Rule of thirds, on demand β Z2J Composition for reproducible layouts
- text
Composition is the invisible difference between a snapshot and a shot. The model doesn't have to follow a rule of thirds, but it's far more likely to when you actually name the rule. Z2J Composition is the ComfyUI-Zero2JSON node that generates the composition line for you - the only node in the pack's composition family, and one of the easiest to overlook. It's also one of the best arguments for why these nodes exist: naming a composition rule is a single phrase with an outsized effect on layout.
In the FLUX2-JSON workflow it feeds the composition slot of the prompt assembler. A generated line bundles a composition rule, an element, and an effect into one phrase - "diagonal composition, leading lines, dynamic tension" - which is the kind of structured, photographic vocabulary the FLUX2 LLM-style encoder genuinely responds to.
How it works
Position-as-seed, standard for the pack: (seed, prompt_index, slot) hashed with xxhash32, hash selects a template and one option per pool. The composition_default.json profile has 4 templates over three pools - rule (12), element (12), effect (12) - about 7,000 combinations. Rules run from rule of thirds and centered to diagonal, symmetrical, dynamic and minimal, with elements like leading lines, negative space and framing devices.
The inputs that matter
seed- world seed.prompt_index- position coordinate; farm it to walk layout options.profile- dropdown ofcomposition_*.jsonfiles; custom ones show up after restart.prefix/suffix- anchors around the composition phrase.composition_style- a filter dropdown (rule_of_thirds / centered / diagonal / symmetrical / dynamic / minimal). Fine print: in v1.0.0 as shipped this is declared but ignored by the generator. It doesn't filter yet - check for a newer release.
Output is a single text string.
Install
All seventeen nodes, one repo:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/ComfyUI-Zero2JSON
cd ComfyUI-Zero2JSON
pip install -r requirements.txt
Restart ComfyUI. Only dependency: xxhash>=3.0.0. No models, no API keys. ComfyUI Manager: search "ComfyUI-Zero2JSON".
Where people get burned
Composition words are commitments. "Centered, symmetrical" and "dynamic diagonal" in the same prompt cancel out into whichever is louder, and you'll wonder why the layout feels uncommitted. Pick one rule per image and let the camera nodes negotiate the rest. Also be aware that composition instructions from text are a soft suggestion, not a hard constraint - if you truly need a specific layout, ControlNet-based methods are the real answer. This node is for nudging and for repeatable variety, not for pixel-level layout guarantees. Know which tool does which job and you'll be happier with both.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00β4294967295 | World seed for deterministic generation |
| prompt_index | INT | 00β4294967295 | Position in infinite prompt space |
| profileopt | COMBO | composition_default.json | Select vocabulary profile |
| prefixopt | STRING | Text to prepend to generated prompt | |
| suffixopt | STRING | Text to append to generated prompt | |
| composition_styleopt | COMBO | any | Filter by composition style |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | β |