Nodes/comfyui-panels/Save Panel Layout
ComfyUI Node

Save Panel Layout

Your layouts, saved as PNGs that are secretly the layout itself

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Save Panel Layout
  • layout
    draw_asfalse
    filename_prefixPanelLayout

    Save Panel Layout is how you build a library of reusable comic page structures. It takes a layout, renders it as an image, and - here's the trick - embeds the entire layout as text metadata inside that PNG. The image you see is just the preview; the real payload is invisible, and it's exactly what Load Panel Layout reads back later.

    That's the part that makes this pack worth learning. A panel layout is an abstract tree of cuts (direction, angle, split positions), and in this pack it's serialized to a compact string like V0_0(H0_0(),H0_0(V15_0(),H0_0())) - a tiny little language of V/H cuts and angles. Save Panel Layout stamps that string into the PNG's cut_tree metadata chunk. The sample layouts folder in the repo is full of these: ordinary-looking PNGs you can drag into ComfyUI and treat as saved layouts. It's the same trick as a workflow image, applied one level down.

    Inputs are few:

    • layout - a PANEL_LAYOUT from the random/grid generators or Mutate.
    • draw_as - flips the drawn image between left-to-right and right-to-left reading. Note the tooltip carefully: the stored data is identical either way. This is purely about how the preview looks, for people who think in manga RTL pages.
    • filename_prefix - default "PanelLayout", supports ComfyUI's formatting tokens like %date:yyyy-MM-dd% or %CanvasPanel.width%, so you can organize a real file system out of your page library.

    It writes to your ComfyUI output directory with the usual counter suffix (PanelLayout_00001_.png), and it's marked as an output node - that's ComfyUI's way of saying this is a terminal node that also shows its result in the UI.

    Where this shines: you generate a page layout, tweak it, save it, and never have to reconstruct it from a screenshot or a seed again. Later you can reload the PNG, mutate it, and save the variant as a new file - a whole chapter of page skeletons accumulating as a folder of small images. The alternative - treating layouts as throwaway and re-rolling every time - is how you end up with every page looking like the same grid.

    One real gotcha: since the layout lives in the metadata, don't re-encode the PNG through tools that strip metadata (screenshots, most image editors, social-media uploads). The preview image survives; the layout usually doesn't. If you ever load a PNG and Load Panel Layout errors out complaining there's no cut_tree metadata, that's exactly what happened.

    Installing

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

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

    The pack needs shapely, matplotlib, and opencv-python - no model files, no GPU. Shapely is pinned to an exact version, so a version conflict with another pack is the realistic failure mode if nodes don't load.

    CategoryBmad/Panels

    Inputs (3)

    NameTypeDefaultDescription
    layoutPANEL_LAYOUT
    draw_asBOOLEANfalseFlips the layout drawn on the stored image but the stored data is exactly the same.
    filename_prefixSTRINGPanelLayoutThe prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes.

    Outputs (0)

    No outputs