π FRED Auto Image Tile from Mask
Split an image into tiles from a mask or BBOX, overlap included
- image
- preview_bbox_color
- MASK
- BBOX
- IMAGES
- preview
- tile_width
- tile_height
- overlap_x
- overlap_y
- rows
- columns
- help
If you've ever hand-built a tiling workflow - cut an image into chunks, run each chunk through a high-res pass, stitch it back - you know the pain is all in the bookkeeping. FRED_AutoImageTile_from_Mask automates the cutting. Give it an image and either a mask or a BBOX and it slices a grid for you, with controllable overlap, and hands you a preview so you can see exactly where the seams will land. This is the classic territory of tiled upscaling on limited VRAM, where overlapping tiles keep a ControlNet-tile or detail pass from diverging between tiles (the patchwork artifact that the upscaling doc keeps warning you about).
How it works
The two ways in:
- Auto mode (
auto_from_mask_bboxon, the default). You feed an optionalMASKorBBOXand it derives the grid from that region's bounds.confidenceshrinks or expands the box (1.0 = use it as-is, lower = tighter).Auto_grid_strategypicks how the rows/cols are chosen -min_balanced(default) gives you a roughly square grid, or you can bias toward rows or columns with the other strategies.max_divisionscaps how fine the grid can get, which is your guard against a tiny bbox producing a 40x40 tile explosion. - Manual mode. Flip
auto_from_mask_bboxoff and setmanual_rows/manual_colsdirectly. Simple as that.
The one rule it enforces: a 1x1 grid is forbidden, because one tile is just the image again. At least one dimension has to be greater than 1, which also means if you only need horizontal strips, set one side to 1 and the other to your strip count.
Overlap comes in two flavors: overlap as a ratio (0β0.5 of the tile), and overlap_x / overlap_y in absolute pixels (default 56px). Absolute pixels is usually the more predictable choice for upscaling, where you want a fixed feather margin between tiles. If a BBOX comes in xywh format instead of x0y0x1y1, switch bbox_mode. And when multiple BBOXes arrive, input_bbox_management decides whether to use the first, last, all, or bail (none_if_multi).
The outputs that matter
IMAGES- the actual tiles, a batched IMAGE tensor. Wire these into whatever per-tile processing you're doing.preview- original image with the grid lines and BBOX drawn on, in your chosenpreview_bbox_color. Check this before running a long per-tile pass; a wrong grid costs you the whole batch.tile_width/tile_height,overlap_x/overlap_y,rows/columns- all the numbers you need to stitch the tiles back together downstream (handy as constants for a crop-and-composite step).
There's no built-in re-stitcher in this node - it's a cutter, not a patcher. You'll typically pair it with something that re-assembles using the same grid geometry, or use it to feed region-based processing like the Impact Pack detailer loop.
Install
Same pack as the rest of the FRED family:
cd ComfyUI/custom_nodes
git clone https://github.com/Poukpalaova/ComfyUI-FRED-Nodes_v2.git
Restart ComfyUI, or grab "ComfyUI FRED Nodes v2" through ComfyUI Manager. It depends on opencv-python and numpy from the pack's requirements.txt, which pip handles on first install.
Gotchas
The BBOX input expects a BBOX-typed wire - the kind Impact Pack detectors emit - not a raw list of numbers. And if you're tiling for upscaling, remember the overlap needs to be generous enough to cover the feather/context margin of whatever you're running per-tile; 56px is a reasonable starting point for 1.5x upscales, not a magic number.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| auto_from_mask_bbox | BOOLEAN | true | β |
| bbox_mode | COMBO | x0y0x1y1 | 2 options: x0y0x1y1, xywh |
| input_bbox_management | COMBO | all | 4 options: none_if_multi, first, last, all |
| Auto_grid_strategy | COMBO | min_balanced | 6 options: max_rows_cols, min_rows_cols, max_rows_min_cols, min_rows_max_cols, min_balanced, max_balanced |
| max_divisions | INT | 52β256 | β |
| confidence | FLOAT | 1.00.1β1 | β |
| manual_rows | INT | 31β256 | β |
| manual_cols | INT | 31β256 | β |
| overlap | FLOAT | 0.000β0.5 | β |
| overlap_x | INT | 560β8192 | β |
| overlap_y | INT | 560β8192 | β |
| preview_bbox_color | COLOR | #FFC800 | β |
| MASKopt | MASK | β | |
| BBOXopt | BBOX | β |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| IMAGES | IMAGE | β |
| preview | IMAGE | β |
| tile_width | INT | β |
| tile_height | INT | β |
| overlap_x | INT | β |
| overlap_y | INT | β |
| rows | INT | β |
| columns | INT | β |
| help | STRING | β |