Nodes/ComfyUI-ZML-Image/ZML_遮罩分割-五
ComfyUI Node

ZML_遮罩分割-五

Split a canvas into up to five vertical strips, without a mask

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_遮罩分割-五
    • 遮罩1
    • 遮罩2
    • 遮罩3
    • 遮罩4
    • 遮罩5
    • 单独遮罩
    • 完整遮罩
    宽度1024
    高度1024
    分割数量5

    The "more strips" version of ZML_MaskSplitNode. Same idea - no mask input, pure geometry, you give it a canvas size and it manufactures the splits - but instead of two halves you get up to five equal vertical strips.

    If you've ever built a workflow that needs "region 1, 2, 3, 4, 5 across the image, each with its own prompt or its own processing," you know the annoying part is usually just generating those five masks. This node is that annoyance removed: it always emits five full-size masks, and the 分割数量 slider decides how many of them actually contain a white strip.

    The inputs and outputs

    • 宽度 / 高度 (default 1024 each) - the canvas. Match to your generation resolution; nothing here reads your actual image.
    • 分割数量 (1–5, default 5) - how many strips to actually produce. Set to 3 and you get three filled strips; masks 4 and 5 come out empty (all black).

    Outputs:

    • 遮罩1 through 遮罩5 - each a full-size mask. For 分割数量 = N, strips 1..N are white bands of equal width and the rest are empty.
    • 单独遮罩 - a single cropped strip at minimal width (the width of one segment), useful when you want one representative region as a small tensor.
    • 完整遮罩 - an all-white full-canvas mask.

    The strips are always vertical, by the way. Unlike the two-way ZML_MaskSplitNode, there's no 横/diagonal option here - if you need horizontal or diagonal splits, use the two-way node instead.

    What it's for

    The obvious use is regional conditioning across a wide canvas: five columns, five prompts, one composite. It also slots into the ZML pack's sub-workflow and list machinery - since each mask is just a tensor, you can treat 遮罩1..5 as five values to fan out to five copies of a sub-pipeline. Given the pack's recent push on lists and batching (the author added "批次转列表" and list-output nodes around the same era), thinking of these as a poor-man's batch is the right mental model.

    The quirk to know

    单独遮罩 is only ever the first segment. It's not the currently-active strip or a crop of the whole thing - the code hard-codes it to the width of segment one. Fine if that's all you need; mildly surprising if you assumed it tracked 分割数量. It's a small, harmless detail and the kind of thing that tells you this node is built for one specific workflow rather than generality.

    Install

    Standard pack install - this is one node of 160+ in ComfyUI-ZML-Image:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zml-w/ComfyUI-ZML-Image
    # restart ComfyUI
    

    or via ComfyUI Manager (search "ComfyUI-ZML-Image"). No dependencies beyond the pack baseline. Chinese-first UI; English users, get the translation patch at https://github.com/zml-w/ZZZ_ZML_English_Patch.

    One-person project, so treat everything with the author's own caveat: nodes he uses constantly are polished, others may have rough edges. This one is dead-simple numpy masking, so it's been reliable - the only thing to trip on is the 单独遮罩 behavior above.

    Categoryimage/ZML_图像/遮罩

    Inputs (3)

    NameTypeDefaultDescription
    宽度INT1024
    高度INT1024
    分割数量INT51–5

    Outputs (7)

    NameTypeDescription
    遮罩1MASK
    遮罩2MASK
    遮罩3MASK
    遮罩4MASK
    遮罩5MASK
    单独遮罩MASK
    完整遮罩MASK