Nodes/neo-studio/Neo Grid Split (宫格图拆分)
ComfyUI Node

Neo Grid Split (宫格图拆分)

Turn one storyboard sheet into a batch of first frames

By neoneo-ai·Created 3 months ago·Updated about 6 hours ago· 6
Neo Grid Split (宫格图拆分)
    • image
    • prompt
    ◄filename▾►
    ◄rows▾►
    ◄cols▾►

    You asked a model for a 3×3 storyboard sheet - nine panels, thin white gutters, maybe a title bar and a caption strip. It is a great way to plan a video: one generation instead of nine, consistent style, the whole story in one glance. Then you want to actually use those panels as image-to-video first frames, and you are back to cropping nine times by hand, hoping you did not leave a sliver of separator in the shot.

    NeoGridSplit exists for exactly that one job. Feed it the sheet, get every panel back as a single IMAGE batch in reading order, cleaned.

    What it actually does

    Then it guesses the grid. For every row and column it measures mean brightness and standard deviation, and calls something a separator when it's both flat and extreme in brightness - near-white gutters or near-black borders, never mid-tone image content - with a minimum run of four pixels so a dark shadow band doesn't pass as a frame. If only part of a separator is found you'd get a "cell" three panels wide, so a size-consistency check (~10% tolerance) falls back to even division when the result looks wrong.

    Two upsides fall out of that. Title bars and footer lines get merged into the neighbouring cell instead of emitted as 12-pixel "images" you notice later. And each cell is trimmed after cutting: uniform white/black frames off all four sides, then a bottom caption band, which it recognises as white background plus dark text - counting strokes per row so a photo whose bottom happens to be white isn't eaten.

    Cells are assembled row-major into one [N,H,W,C] batch, all scaled up to the largest cell's width and height. That's the catch: uniform panels come out perfect, mixed-aspect panels get stretched, not letterboxed.

    The surprise feature is the second output. prompt is a STRING scraped out of the sheet PNG's own embedded ComfyUI metadata - every text input that looks like a prompt, deduplicated, with nodes wired only to a negative input filtered out. Whatever prompt built your sheet comes back as usable text. It only works on the original file: metadata is a text chunk in the PNG, and anything that re-encodes the image takes it with it.

    Inputs and outputs

    The only required input is filename - a dropdown of the PNGs/JPGs/WebPs in ComfyUI/input/, with an upload button on the node so you can drag a sheet in without touching the filesystem. The optional ones are rows and cols (auto, or 1–12). auto usually gets it right, but if your sheet has a region that shades uniformly, detection can land on the wrong grid - pin both and the node divides evenly instead, which is fine on a deliberate grid.

    Outputs: image (the batch) and prompt (the string). image plugs into anything that takes a batch - a SaveImage to dump all nine panels into output/, ImageFromBatch if you only want panel four, or the first-frame input of your i2v model. This is the pack's own H3 storyboard path in node form: Neo H3 Video Director does the same split internally to make each grid cell a segment's first frame. prompt goes into a text encode, or into one of the pack's prompt nodes.

    It's an output node (OUTPUT_NODE), so it runs even with nothing plugged in - queue once and read the cell, row and column counts off its status line to confirm the split before wiring anything downstream.

    Installing

    ComfyUI Manager → search Neo Nodes → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/neoneo-ai/ComfyUI-Neo-Nodes.git ComfyUI-Neo-Nodes
    

    No model downloads, no GPU work, nothing to configure - it's pure Pillow and numpy, both of which you already have. The pack's requirements.txt pulls Pillow, PyYAML, pypinyin and openai; the last two are for prompt/LLM features in other nodes. (The README's dependency list is stale and mentions requests; requirements.txt doesn't.) llama_cpp_python is the heavy optional one, and only for local LLM inference.

    When it goes wrong

    The node isn't in the menu at all. Every Neo node registers inside a try/except that prints [NeoNodes] ... 注册失败 and moves on. A missing node is never an error dialog - it's a line in your ComfyUI console.

    The filename dropdown is empty. Nothing matchable is in ComfyUI/input/. Use the node's upload button, or drag an image card from the pack's Gallery panel onto the node - it copies the file into input/ and fills the widget for you.

    Split is off by one row or column. A bright or dark band in the art fooled the profile. Pin rows and cols; on a deliberate grid, equal division usually beats detection anyway.

    A panel came out stretched. The batch is unified to the largest cell's dimensions, so mixed-aspect panels in one sheet have nowhere to go. Regenerate as a uniform grid.

    prompt came out blank. Either the sheet wasn't saved by ComfyUI (no metadata chunk) or it was re-encoded along the way. The split still works; the prompt doesn't.

    The bottom of a panel lost a few pixels. The caption trim saw white background with text-like strokes and cut it - it's tuned for sheets with a caption bar under each panel.

    CategoryNeo Studio

    Inputs (3)

    NameTypeDefaultDescription
    filenameCOMBOinput/ 里的宫格图(选一张);提示词从这张图的 PNG 元信息提取。
    rowsoptCOMBO行数:auto = 自动检测(含细白条回退与大小一致性校验)。
    colsoptCOMBO列数:auto = 自动检测;检测不准时手动指定。

    Outputs (2)

    NameTypeDescription
    imageIMAGE各格清理后按行优先拼成的 IMAGE 批次 [N,H,W,C](统一到最大宽高),接多图/多帧下游。
    promptSTRING原宫格图 PNG 元信息里的 ComfyUI 提示词(换行分隔),接 NeoPromptAgent / NeoImageGenEdit 的 prompt。