MASK to Tile SEGS
Turn a mask canvas into a grid of Impact-compatible regions
- mask
- image
- segs
- masks
Tiled upscaling and per-region refinement both need the same thing: a big canvas broken into overlapping pieces that a node pack will iterate over. In ComfyUI the currency for "pieces to iterate" is SEGS, the Impact Pack's container for detected regions - and SEGS normally comes from a detector. MASK to Tile SEGS skips the detector entirely. It slices one mask canvas on a grid and emits Impact-compatible SEGS, so you get the same plumbing without any model deciding where the regions are.
How it works
It builds a tile layout from the mask's dimensions and then, for each tile, creates a SEG entry with the crop rectangle in source coordinates, the cropped mask, a content bounding box measured from the tile's nonzero pixels, confidence 1.0 and an empty label. The pack defines its own SEG record for this, matching Impact's field names, so Detailer, SEGSPaste and friends accept the result without you installing anything extra - the pack duck-types the interface rather than importing Impact.
The second output is the mask tiled into an ordinary MASK batch, one plane per tile, each padded out to the tile tensor size. That's the thing you run through a sampler when you want per-tile generation.
Choosing a mode - this is the part to read
mode is a three-way switch and the other widgets mean different things depending on which you pick. That's the main source of confusion here.
fixed_tile- tiles are exactlytile_width×tile_heightand the grid is however many it takes to cover the canvas, usingoverlap_x/overlap_ybetween neighbours.max_columns/max_rowsare ignored.bounded_grid- same overlap idea, but the grid is capped atmax_columns×max_rows, which means the tiles get larger than requested to cover the same area. This is the one to pick when you want "never more than a 3×3 grid of passes on this GPU", and the honest cost is that the actual tile size is computed, not the number you typed.uniform_grid- tiles land on evenly-spaced positions that hit the source edges exactly, usingmin_overlap_x/min_overlap_yandmin_columns/min_rows.overlap_x,overlap_y,max_columnsandmax_rowsare ignored in this mode. If you switch to uniform and your overlap seems to do nothing, that's why.
Guardrails from the source that will bite you: overlap must be smaller than the tile and no more than half of it, so overlap_x of 128 needs tile_width of at least 256. In uniform_grid, asking for min_columns above 1 when the canvas is narrower than one tile is an error, not a clamp.
Inputs and outputs
mask must be one canvas - rank-2 or a batch of exactly 1. Feed it 8 frames and it will refuse: this node represents a single source canvas and says so in the error. image is optional but useful: if you wire the source image in, each SEG carries the cropped image, which is what makes the SEGS renderable by preview nodes and usable for img2img without extra plumbing. Its batch size must also be 1 and its H/W must match the mask.
Outputs: segs and masks. segs goes into Impact's Detailer (SEGS), SEGSPaste, or any SEGS consumer; masks goes into a sampler as an ordinary batch.
What you'd pair it with
Reorder SEGS, to control the order the tiles get processed in - center-out is often what you want for an upscale, because the most important content is where you put it. Filter Tile SEGS and Restore Tile SEGS Gaps, to drop tiles with no content and then repair the seams that leaves. And Preview SEGS Regions, which draws the resulting grid with overlap multiplicity so you can see the geometry before you spend a single GPU second on it. That combination is the pack's actual thesis: tiling you can inspect.
Install
Manager: search ComfyUI Utility Suite (publisher tom-m) → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/tom-m-2020/ComfyUI-Utility-Suite
No models, no downloads; the pack's only dependency is opencv-python-headless. Two practical notes. First, to use SEGS downstream you'll want the Impact Pack installed - this node produces the container, it doesn't consume it. Second, the pack is built on ComfyUI's V3 node API, so an outdated ComfyUI imports the folder and registers nothing.
Troubleshooting
"requires MASK batch size 1." You wired a batch in. Pick one frame first, or run this before you batch.
"overlap_x must not exceed half of tile_width." Halve the overlap or double the tile.
The grid came out as a single tile. The canvas is smaller than the tile in both axes, so there's only one position available. That's not a bug - check tile_width/tile_height against the actual mask size.
Downstream Impact node complains about the SEGS. Fields like control_net_wrapper and label come across as empty, which is fine for detailers and paste nodes but can matter to nodes that expect a conditioning wrapper per region.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| mode | COMBO | 3 options: fixed_tile, bounded_grid, uniform_grid | |
| tile_width | INT | 10241–32768 | — |
| tile_height | INT | 10241–32768 | — |
| overlap_x | INT | 1280–16384 | — |
| overlap_y | INT | 1280–16384 | — |
| max_columns | INT | 31–256 | — |
| max_rows | INT | 31–256 | — |
| min_overlap_x | INT | 1280–32768 | — |
| min_overlap_y | INT | 1280–32768 | — |
| min_columns | INT | 11–32768 | — |
| min_rows | INT | 11–32768 | — |
| imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| segs | SEGS | — |
| masks | MASK | — |