Nodes/comfyui-panels/Random Panel Layout Generator
ComfyUI Node

Random Panel Layout Generator

Random comic page layouts on demand — the usual place a page starts

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Random Panel Layout Generator
    • PANEL_LAYOUT
    num_panels5
    max_cuts2
    min_angle-25
    max_angle25
    seed0

    Every comic page in comfyui-panels starts the same way: with an abstract layout, not a picture. Random Panel Layout Generator is the node that makes one up for you, and it's usually the first thing you'll drop on the canvas when you want a manga-style page that isn't just a boring grid.

    The pack's mental model is worth getting straight early, because it explains why this node outputs something you can't see yet. A panel layout is a hierarchical tree of cuts - which direction to slice the page (vertical or horizontal), at what slight angle, and how many slices per node. The tree is "abstract" in that it stores no concrete sizes, margins, or corner shapes; those get resolved later when you feed the layout into Build Layout Panels, which turns it into real panel polygons on a canvas.

    Mechanically, the generator grows a cut tree one node at a time until it reaches your target panel count. Each node randomly picks a cut direction, an angle from your min/max range, and a split mode (midpoint, thirds, golden-ratio-ish positions). One honest quirk: the panel count is approximate. Because cuts are added per-node and a single node can produce several panels, you might land a panel or two over your target. If you need exactly N panels, generate, count with a preview, and re-roll - or use the seed.

    The inputs a beginner actually sets:

    • num_panels - target panel count, 2 to 32, default 5. Keep it modest; very dense pages turn into spaghetti when the cuts stack.
    • min_angle / max_angle - how much the cuts can deviate from straight, default -25 to +25 degrees. Zero/zero gives you clean right-angle layouts; wider ranges give that dynamic, tilted-panel look.
    • max_cuts - the maximum number of cuts a single node can make, default 2.
    • seed - the usual ComfyUI seed semantics with a control-after-generate widget. Find a layout you like, then step the seed for variants.

    Output is a single PANEL_LAYOUT. Wire it into Build Layout Panels (pick your canvas size and margin there), then Preview Panel Layout to actually look at it before you commit to generating art inside it.

    The workflow pairing people actually use: run this node to land a good starting structure, then feed the result into Mutate Panel Layout to produce siblings of that page - you keep the pacing you liked while getting visual variety page after page. Re-rolling the random generator from scratch every page gives you variety but no control; mutating one good base gives you both.

    Installing

    Part of the comfyui-panels pack by bmad4ever. Install via ComfyUI Manager (search "comfyui-panels") and restart, or:

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

    Dependencies are shapely, matplotlib, and opencv-python - no models to download, no GPU needed, pure CPU geometry. Just note that shapely is pinned to an exact version, and a version clash with another pack is the most likely way this pack fails to import.

    CategoryBmad/Panels

    Inputs (5)

    NameTypeDefaultDescription
    num_panelsINT52–32
    max_cutsINT21–9
    min_angleINT-25-45–45
    max_angleINT25-45–45
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    PANEL_LAYOUTPANEL_LAYOUT