Nodes/comfyui_gr85/Island Mask Generator
ComfyUI Node

Island Mask Generator

Cutting one mask into a grid of separate islands

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Island Mask Generator
  • processed_mask
  • island_mask
grid_size128
border_thickness4

comfyui_gr85 has a small cluster of mask nodes - Island Mask Generator, Mask Splitter, Mask Connect MST - that don't show up in the pack's own README at all. That's not a knock on the pack, it's just an indie utility collection where the docs lag the code a bit; the "node overview" section covers resolution helpers, prompt helpers and random utilities and stops there. So this one's read straight off what the node actually exposes, not off any write-up.

What it does, going by the parameters: feed it a mask and it slices that mask along a grid, turning one solid blob of white into a checkerboard of separate disconnected "islands." grid_size sets the spacing of the cut lines, border_thickness sets how wide a gap gets carved along each line. Bigger grid, fewer and bigger islands; thicker border, wider gutters between them. The output, unsurprisingly, is called island_mask.

Why you'd want that: once a mask is chopped into discrete islands, you can treat each one separately downstream. That's exactly the shape of workflow the pack's other mask nodes are built for - Mask Splitter pulls a mask's connected regions apart into individual entries with bounding boxes, and Mask Connect MST does the reverse, stitching scattered islands back into one continuous shape with a minimum-spanning-tree of connecting lines. Island Mask Generator looks like the entry point to that pipeline: take a solid region, deliberately carve it into tiles, maybe run each tile through its own detail pass (Mask Batch to SEGS → an Impact Pack Detailer, for instance), then reconnect afterward if you need the mask whole again.

The inputs that matter. processed_mask is the mask you're carving - the name implies it's expected to already be cleaned up, not a raw noisy detection. grid_size (16–512, default 128, step 16) is the tile spacing. border_thickness (1–32, default 4) is the gap width cut between tiles. There's exactly one output, island_mask, and it wires anywhere a MASK is expected - into the pack's own Mask Splitter, into SetLatentNoiseMask, into an inpainting node, whatever your pipeline needs next.

Installing it. Same as the rest of the pack: search "comfyui_gr85" in ComfyUI Manager, or manually -

cd ComfyUI/custom_nodes
git clone https://github.com/veighnsche/comfyui_gr85

Restart ComfyUI. This is grid math on a mask array, not a model - no downloads, no extra GPU dependency beyond whatever's already loaded for the rest of your graph.

Where this can go sideways. If grid_size is close to or larger than your mask's actual dimensions, you'll get zero or one cut lines and the output will look identical to the input - not broken, just not doing anything visible at that scale, so check your mask's pixel dimensions before assuming the node is misbehaving. And if border_thickness is too thin relative to how detailed your mask edges are, adjacent islands can end up still touching by a pixel or two, which defeats the point if you're about to hand them to Mask Splitter expecting clean separation - nudge the thickness up until a mask preview actually shows daylight between the tiles.

CategoryGR85/Mask

Inputs (3)

NameTypeDefaultDescription
processed_maskMASK
grid_sizeINT12816–512
border_thicknessINT41–32

Outputs (1)

NameTypeDescription
island_maskMASK