Nodes/comfyui-mixlab-nodes/Splitting a long image into sections
ComfyUI Node Runs on cloud

Splitting a long image into sections

Slice one long mask into equal sections

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
Splitting a long image into sections
  • long_mask
  • MASK
count1

A narrow utility that does one thing cleanly: take a long mask and cut it into a set number of equal sections, handed back as a list. If you've got a tall or wide mask that really represents several regions stacked together - panels, tiles, strips - this splits them apart so each can drive its own step. It's the mask-side companion to the pack's "split a long image into sections" idea.

Where you'd reach for it

Think regional or tiled work. You've built (or generated) one big mask that covers, say, four vertical panels of a comic page, or several tiles of a larger canvas. Downstream you want to process each region separately - a different inpaint per panel, or a per-tile operation. Rather than authoring four masks by hand, you author one and let this node chop it into the pieces, evenly, on demand. It fits the Mixlab "layers" and long-poster workflows the README shows off.

The inputs

  • long_mask - the mask to slice. Required.
  • count - how many equal sections to cut it into (default 1, up to 1024). Set this to the number of regions you want out. count of 4 gives you four equal slices.

Output is a MASK list - the sections, in order. Feed the list into whatever iterates masks (a batched inpaint, a per-region compositor), or index into it with a switch node to grab a specific slice.

Installing it

Get the pack via ComfyUI Manager (search mixlab, install comfyui-mixlab-nodes, restart), or clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-mixlab-nodes

then install requirements and restart. No downloads - it's pure mask math.

Common snags

  • The splits don't line up with your regions. It cuts into equal sections, so it assumes your regions are evenly spaced. If your panels are uneven, equal slicing won't respect their real boundaries - you'd need to author separate masks or split at custom positions some other way.
  • Only one section back. count is at its default of 1. Set it to the number of pieces you actually want.
  • Downstream expects a single mask, not a list. This outputs a list. Either feed a node that iterates the list, or use a switch/index node to pick one section out of it.
  • Handy pairing: split here, process each section, then recombine - the same regional pattern people use for tiled upscaling and multi-area conditioning, just built from one source mask.
Category♾️Mixlab/Mask

Inputs (2)

NameTypeDefaultDescription
long_maskMASK
countINT11–1024

Outputs (1)

NameTypeDescription
MASKMASK