Nodes/comfyui-panels/Load Panel Layout
ComfyUI Node

Load Panel Layout

The layout that hides inside an image file

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Load Panel Layout
    • PANEL_LAYOUT
    image

    comfyui-panels treats a panel layout as a tree of cuts - an abstract description of "cut this page here, then cut that panel again." That structure is compact and storable, and the pack's convention is to embed it in the metadata of a PNG. Load Panel Layout is the node that reads it back out.

    You'll use this node in two situations. Either you saved a layout earlier with Save Panel Layout and you want to reuse it, or you're loading one of the ready-made layouts the pack ships in its sample_layouts folder. The pack is genuinely nice here: those sample PNGs aren't screenshots, they're working layout files with the cut data baked in, so you can drag one into this node and immediately get a workable PANEL_LAYOUT.

    How it works

    When you save a layout, the pack serializes the cut tree into a compact text code (something like V15_3(...), where V/H mark vertical/horizontal cuts, the number is the angle in degrees, and the parens nest child cuts). Save Panel Layout draws a preview image and embeds that code as a cut_tree PNG text chunk. Load Panel Layout is the reverse: it opens the PNG, pulls the cut_tree metadata out, and parses it back into a live layout object.

    One subtlety: this node's input is a standard ComfyUI image loader input, so you pick the file in the same upload widget you'd use for any image. But the file has to actually contain the metadata - which is why the node validates the image before running and errors out if cut_tree isn't there.

    The input that matters

    Just one: image, the layout-bearing PNG. Output is a single PANEL_LAYOUT, which you then feed into Build Layout Panels along with a canvas to get actual panel polygons. There's also a text-based path in this pack (String Encode/Decode Panel Layout) if you'd rather carry the layout around as a string than a file - same data, different envelope.

    Installing it

    Part of the comfyui-panels pack, so install the whole thing - ComfyUI Manager, search "comfyui-panels", or:

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

    Restart and let Manager handle the Python deps (shapely, matplotlib, opencv-python). No model downloads here.

    Where people get burned

    The one real failure mode is feeding this node a plain image. A screenshot of a layout, a scraped comic page, a generated preview - none of those carry the cut_tree metadata, and the node will throw "cut_tree metadata not found in provided image." That's not a bug, it's the design: the layout is the metadata. If someone shares a layout PNG with you and it doesn't load, they probably re-saved it through an image editor and stripped the metadata along the way. Grab it from the pack's sample_layouts folder or a fresh Save Panel Layout output and it'll just work.

    CategoryBmad/Panels

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (1)

    NameTypeDescription
    PANEL_LAYOUTPANEL_LAYOUT'Abstract' Panel layout, represented as a tree of cuts.