Nodes/comfyui_bmad_nodes/ExtendMaskList
ComfyUI Node Runs on cloud

ExtendMaskList

Joining Mask Lists When You're Compositing a Whole Scene

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
ExtendMaskList
    • MASK
    inputs_len2

    ExtendMaskList concatenates several MASK lists into one, in order. It comes from the same Extend*List family as the rest of bmad4ever's comfyui_bmad_nodes pack, and if you've ever needed to mask five objects in one scene you already know why it exists: masks come from different detectors, at different times, and you want them treated as one list downstream.

    Why you'd reach for it

    Mask-heavy workflows are the poster child for this. You cut a subject out with one masking node, isolate a region with another, and want to composite them together or feed them to an inpainting pass as a group. Rather than duplicating the downstream nodes per mask, ExtendMaskList merges the sources into a single MASK list that one chain of nodes can consume.

    The other common case is cleanup: you have multiple rough masks you'll blend or refine together, and keeping them as separate list-making nodes means you can mute one branch without ripping up the graph. This pack is full of CV nodes that emit masks (Color Clip, MonoMerge, the GrabCut family), and this is the node that collects their output into a usable batch.

    How it works

    Standard Extend family behavior: the inputs_len widget (default 2, up to 32) controls the number of mask-list inputs, and you have to right-click → "update Inputs" after changing it (the README's ❔ marker). Each input socket is a list of MASK tensors; the node extends them onto one output list, top input first.

    One gotcha specific to masks: some nodes emit a single MASK, others emit a MASK batch, and neither is a list. If the socket won't connect, run the single mask through a ToMaskList node (same pack) to wrap it before it reaches ExtendMaskList.

    Install

    It ships in the bmad4ever pack - install that once:

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

    then restart ComfyUI. Manager users search "comfyui_bmad_nodes". The pack's requirements (opencv-python, scikit-image, simpleeval, gray2color) install with it, and if you're using this node you're probably using the CV half too, so let them install rather than skipping.

    Common issues

    • Missing sockets. inputs_len changed but no new inputs - right-click → "update Inputs".
    • Single mask vs list. Wrap lone masks with ToMaskList first.
    • Ordering for compositing. Masks come out in input order; when stacking foreground objects, the last mask in the list usually means "on top", so arrange accordingly.

    It's the quiet glue of multi-mask compositing - unglamorous, and exactly what you want when the alternative is five parallel copies of the same node.

    CategoryBmad/Lists/Extend

    Inputs (1)

    NameTypeDefaultDescription
    inputs_lenINT20–32

    Outputs (1)

    NameTypeDescription
    MASKMASK