Nodes/MOSS Storyboard & Layout/MOSS Storyboard Layout
ComfyUI Node

MOSS Storyboard Layout

The grid math you'd otherwise get wrong

By ZenHG·Created 7 days ago·Updated about 18 hours ago· 9
MOSS Storyboard Layout
    • width
    • height
    • columns
    • rows
    • spec
    • layout_json
    • template
    • report
    • elements
    ◄prompt►
    ◄panels8►
    ◄panel_aspect16:9►
    ◄panel_edge512►
    ◄canvas_aspectauto►
    ◄columns0►
    ◄rows0►
    ◄gutter8►
    ◄margin8►
    ◄cell_gray25►
    ◄invertfalse►
    ◄labelobject►
    ◄char_boxes►

    A 4×2 storyboard grid of 16:9 panels looks like trivial arithmetic until you hand it to a diffusion model. The canvas must be a multiple of 16 or the VAE quietly truncates it. Every panel has to be identical in size to the pixel or your batch stacking throws. The leftover pixels from alignment need somewhere to go that isn't a visible asymmetry. And the crop downstream has to agree with all of it.

    This node is that arithmetic, done once, in one place. It loads no model: instant, deterministic, runs on a machine with no GPU.

    What it gives you

    Tell it how many panels and roughly how big, and it computes the layout: canvas size, columns and rows, each cell's rectangle. Then it emits that geometry in four shapes, because four consumers want it differently.

    The one you'll use most is spec: a short string like MOSS-SB1 panels=4 w=1024 h=576 cols=2 rows=2 pw=496 ph=272 gutter=8 margin=8 carrying the entire layout down one wire. Wire it into the Sampler, Crop or Paste and those nodes stop guessing. That's the plumbing-layer value-node pattern: one source fanned out, so five nodes can't disagree about the grid.

    layout_json is the same format the host's own MOSS layout prompt emits - summary plus items with absolute-pixel bboxes from canvas centre. Straight into a CLIPTextEncode. elements is a different format for a different consumer: {type, desc, bbox} with 0–1000 normalised bboxes in [y0, x0, y1, x1] order, built for the host's Create Bounding Boxes node so you can see and edit cells on that canvas.

    template is a preview image of the grid - grey cells at cell_gray (default 25) broken by your gutter. For your eyes; it does not enter sampling. report is one line: panel count, canvas, megapixels, how many prompt segments lined up, oversize warnings. The rest are plain numbers - width, height, columns, rows - for an EmptyFlux2LatentImage or a bounding-box node.

    The inputs that matter

    panels is what you came for: 3, 4, 6, 8 or 9. Then panel_aspect (ten choices, 16:9 through 2.39:1) and panel_edge, the panel's long edge. Default 512, and the tooltip is honest about why: eight panels at 512 lands the sheet near 1.3MP, inside MOSS's 1–2MP training range. Push it and you leave the range, small text first.

    canvas_aspect sets orientation. auto follows panel orientation; set it explicitly and the same 6 panels become 3×2 or 2×3. To force an arrangement, fill columns (rows auto-completes) or both - and then they must multiply to panels or you get an error rather than a surprise.

    gutter and margin are seam width and outer padding, both default 8. Their tooltips are worth reading: gutter = 0 and the model will happily draw across the boundary; margin = 0 puts content flush to the edge so your crop picks up a rim instead of picture.

    prompt exists and you can leave it empty - this node only computes geometry.

    The advanced pair, cell_gray and invert, are preview styling. label sets the bbox type: object for "this cell is a picture", character to nudge that the cell is a person.

    Install

    Manager, search MOSS Storyboard. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ZenHG/ComfyUI-MOSS-Storyboard
    

    You want [MOSS SB] v0.2.2 in the startup log. The pack installs no pip dependencies - requirements.txt exists purely so Manager skips the pip step. But it needs host ComfyUI ≥ 0.42.0, and to sample anything downstream you need the MOSS trio: moss_image_sft_bf16.safetensors in models/unet/, qwen3.5_9b_int8_convrot.safetensors in models/clip/, flux2-vae.safetensors in models/vae/. This node runs fine without any of them.

    Where people get burned

    Wiring elements into Create Bounding Boxes and getting boxes everywhere. You need three wires: width → its width, height → its height, elements → its bboxes. Normalised 0–1000 coordinates need real pixel dimensions to resolve against, and that canvas node defaults to 1024×1024 while an 8-panel sheet is 2032×576. Skip the wires and you get silently wrong boxes - no error, just nonsense.

    Confusing the two formats. elements (normalised canvas elements) and layout_json (absolute pixels, full layout prompt) are not interchangeable. Swapping them won't parse as you expect.

    Extreme canvas ratios. The pack caps canvas aspect near 4:1, because past that the model paints one long strip and calls it a day. Three 16:9 panels in a row lands around 5.3:1 and is rejected - 3 panels default to a vertical stack for exactly this reason. Set columns = 3 for the row and expect to fight the composition.

    Categorymoss/storyboard

    Inputs (13)

    NameTypeDefaultDescription
    promptSTRING【填什么】故事板稿:开头一段全局描述,然后每格一段用 [PANEL 1] … [PANEL n] 分开。 段数可以少于格数(多余格不约束),也可以多于格数(尾部丢弃)。 ⚠ 没有 [PANEL n] 标记时只输出普通提示词;模板只是预览,不再参与采样。
    panelsINT81–12【填什么】一共几格。常用 3 / 4 / 6 / 8 / 9;其它值会自动做整数分解。
    panel_aspectCOMBO16:9【填什么】单格宽高比。产线做横屏短剧选 16:9;竖屏选 9:16。
    panel_edgeINT512128–2048【填什么】单格长边像素。8 格推荐 512(整图约 1.3MP,落在训练区间内)。 ⚠ 调大会让整图离开 1–2MP 训练区间,小字先崩。
    canvas_aspectCOMBOauto【填什么】整张画布的宽高比目标。auto = 按单格朝向取 16:9 或 9:16。 用途:同样 6 格,选 9:16 会排成 2 列 3 行,选 16:9 会排成 3 列 2 行。
    columnsINT00–12【可留 0】0 = 自动按 canvas_aspect 选。填了就强制列数(行数自动补齐)。
    rowsINT00–12【可留 0】0 = 自动。columns 与 rows 都填时必须满足 列×行 = 格数。
    gutterINT80–64【填什么】格与格之间的缝宽(像素)。0 = 无内缝,模型会跨格连画。
    marginINT80–64【填什么】画布最外圈留白。0 = 内容直接到边,裁格时容易带进毛边。
    cell_grayINT250–255【进阶】模板里单格填充的灰度。近黑(25)最稳;中灰会让成片整体发灰。
    invertBOOLEANfalse【进阶】反相模板:黑底白缝变成白底黑缝。仅在模型不认白缝时试。
    labelCOMBOobject【进阶】布局框的类型。object = 一格当一块画面;character = 强调该格是人物。
    char_boxesoptSTRING【可留空】把哪几格标成人物框,逗号分隔、**编号从 1 起**(如 `1, 3`)。 留空 = 全部用上面的 label。用于同一张里既有主角格又有空镜的场合。

    Outputs (9)

    NameTypeDescription
    widthINT—
    heightINT—
    columnsINT—
    rowsINT—
    specSTRING—
    layout_jsonSTRING—
    templateIMAGE—
    reportSTRING—
    elementsSTRING—