Preview SEGS Regions
See your tile grid and where the overlaps pile up
- segs
- fallback_image_opt
- image
Tiled upscaling is the kind of thing you can spend twenty minutes of GPU time on and only then discover the grid was wrong. Preview SEGS Regions is the node that stops you: it draws a SEGS set's actual crop geometry back onto a full canvas, colours where regions overlap, and stamps each region with its index. It's the difference between hoping your tiles line up and looking at them.
I'd go further than "useful" - for tiled work this is the highest-value node in this pack, because the failure it prevents is invisible until it's expensive.
What you actually see
The output is a single full-canvas image, the same dimensions as the SEGS source canvas:
- Blue lines mark each region's crop boundary, drawn inward by
line_width(default 3). - Yellow tint with diagonal hatching marks pixels covered by exactly two regions. Red tint plus hatching marks three or more.
- A blue number in the middle of each region is its index, font sized to the region - roughly 18% of the region's shorter side, clamped between 12 and 72px - with a dark outline so it stays readable over anything.
That overlap-colouring is the whole trick. Single-coverage areas are left alone; double and triple coverage get progressively louder. So a grid with a sane overlap pattern looks like tidy yellow seams between tiles, and a grid with a bug looks like a solid red block in the middle of the frame. You can see, before running anything, whether your tile positions actually tile.
How it works
It walks the SEGS header for the source dimensions, then for each entry fills the canvas at the entry's crop rectangle - with the entry's own cropped_image if it has one, or with the fallback image if you wired one, or with the mask channel if background is set to mask. The coverage map itself is computed as a 2D difference array over all crop rectangles and cumulatively summed, which is a neat way of getting exact multiplicity without painting each rectangle and counting. Then the tints, hatch, boundaries and labels are composited on top.
Inputs and outputs
segs- required. Any SEGS: a detector's output, or a grid from MASK to Tile SEGS.background-imageormask.imageuses each region's stored cropped image, so it works best with SEGS that carry one (MASK to Tile SEGS only attaches cropped images if you wire its optionalimageinput).maskcomposites the regions' masks as greyscale instead, which is the honest view when you're checking geometry rather than content.fallback_image_opt- optional IMAGE, used to fill the canvas when the SEGS have no cropped image of their own. It must be a single image and must match the SEGS canvas dimensions exactly, or the node raises rather than resizing.line_width- 1 and up. On a 4K canvas with 3×3 tiles, 10 is not too thick.
Output: image, one frame. Straight into Preview Image, or into Save Image if you want to keep the diagnostic.
How you'd use it
The loop is: build a grid → preview it → fix the parameters → then run the expensive thing. Concretely, with this pack: mask or canvas → MASK to Tile SEGS (or your detector) → Preview SEGS Regions → look. If the red block is wrong, adjust the overlap and tile size and look again. Costs you nothing but a second.
It also settles arguments about region identity. The indices it prints are the order the SEGS are in, which is the order a downstream detailer will process them in - so if you want to know which region is index 4 before you feed it into SEG From SEGS to keep just that one, this is how you find out. And if the order isn't what you want, Reorder SEGS is the fix, with this node as the before-and-after picture.
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 to download. The pack's one dependency is opencv-python-headless, which this node doesn't need - it uses NumPy, torch and Pillow. Worth setting expectations: this pack has essentially no community write-ups yet, so the tooltips and the source are your documentation. It's written against ComfyUI's V3 node API, so if the nodes never appear, update ComfyUI first.
Troubleshooting
Black canvas with a grid drawn on it. The SEGS had no cropped images and you didn't wire a fallback, so there was nothing to paint underneath. The geometry is still perfectly readable - this is often all you wanted.
"fallback IMAGE dimensions do not match SEGS." No resizing here by design, since a resized reference image would misrepresent the geometry. Also check the batch size is exactly 1.
Everything is red. You're looking at a triple or higher overlap region. With big overlap_x/overlap_y values relative to the tile size, that's genuinely what your grid is doing, and the render cost of that area is about to triple.
Labels are hard to read. They scale with region size, so small regions get small text. Crop the preview or bump the region size - this is a thumbnail-scale readability limit, not a bug.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — | |
| background | COMBO | 2 options: image, mask | |
| line_width | INT | 31–32768 | — |
| fallback_image_optopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |