Nodes/comfyui-panels/Mutate Panel Layout
ComfyUI Node

Mutate Panel Layout

The layout variation node — turn one comic page into a dozen siblings

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Mutate Panel Layout
  • layout
  • PANEL_LAYOUT
add_cut_prob0.100
rem_cut_prob0.100
num_cut_prob0.100
ang_adj_prob0.100
typ_cut_prob0.050
max_ang_delt15
seed0

If you're making a comic in ComfyUI, the killer feature of Mutate Panel Layout is that you can keep the page structure you already like and ask for siblings instead of starting over. Comic readers notice when every page is a grid; they also notice when a page layout fights the scene. This node hands you a knob for how much the next page should differ from the last.

Here's the context. In comfyui-panels, a "panel layout" isn't yet a picture of panels - it's an abstract tree of cuts (which direction to cut, at what angle, how many times). You generate one with the Random Panel Layout Generator or the Grid Panel Layout Generator, then turn it into actual panel shapes with Build Layout Panels. Mutate Panel Layout sits in between: it edits that abstract tree, so you can explore variations before committing to polygons.

Under the hood it deep-copies the cut tree and walks it with a seeded RNG, rolling dice for five kinds of edit: adding a cut into an empty slot, removing a cut, changing how many cuts a node makes, nudging the cut angle, and swapping the "split mode" (the 1/3, 2/3, golden-ratio presets). Each operation has its own probability input, so you control exactly how much chaos gets injected.

The inputs that matter, in one short list:

  • add_cut_prob, rem_cut_prob, num_cut_prob, ang_adj_prob - each default 0.1. Low values (0.05–0.15) give gentle variation; crank them toward 0.5 and you get pages that barely resemble the original.
  • typ_cut_prob - defaults to 0.05. This one changes the split mode, so start small; it's the most jarring edit.
  • max_ang_delt - how many degrees an angle may shift (default 15, up to 45).
  • seed - same seed, same mutations. This is what makes the node usable: you can find a seed you like, then step it to get the next page.

The single output is a PANEL_LAYOUT, which feeds Build Layout Panels or another Mutate node for deeper churn. Nothing here touches pixels, so the whole thing runs in milliseconds.

One workflow trick that's worth stealing: instead of re-rolling the random generator until a page "feels right," pick one good layout and mutate it. You keep the overall pacing (same number of panels, similar gutters) while getting the variety your eye demands. It's also the easiest way to keep a consistent page count across a chapter.

Installing

This node ships in the comfyui-panels pack by bmad4ever. Easiest route is ComfyUI Manager - search for "comfyui-panels" and install, then restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels

Then restart ComfyUI. The pack's only real dependencies are shapely, matplotlib, and opencv-python - no model downloads, no GPU requirement, all CPU math. The one thing to keep an eye on: shapely is pinned to an exact version in requirements.txt, and since every custom node shares one Python environment, another pack pinning a different shapely can trip pip. If a node starts throwing import errors, that's the first suspect.

CategoryBmad/Panels

Inputs (8)

NameTypeDefaultDescription
layoutPANEL_LAYOUT
add_cut_probFLOAT0.1000–1
rem_cut_probFLOAT0.1000–1
num_cut_probFLOAT0.1000–1
ang_adj_probFLOAT0.1000–1
typ_cut_probFLOAT0.0500–1
max_ang_deltINT150–45
seedINT00–18446744073709550000

Outputs (1)

NameTypeDescription
PANEL_LAYOUTPANEL_LAYOUTPanel Layout