Mosaic: Assemble (Folder)
Stitch tiled-diffusion output back into one image
- image
- save_path
The other half of the tiled-diffusion story. MosaicTileExport cuts an image into tiles, you process them, and MosaicAssembleFromFolder puts them back. This is the folder-based variant: instead of taking a batch tensor, it reads tiles straight from a directory - which is exactly what you want when the tiles were processed by an external tool, a second ComfyUI instance, or any pipeline that wrote files instead of keeping tensors in memory.
How it works
The node globs a folder for files (default output/tiles/*.png), sorts them, and places each tile onto a rows × cols canvas. The placement logic is where it gets interesting, and the star is order_mode:
- row_major / column_major / snake_row / snake_col - the classic scan orders, for when tile order in the folder matches grid order.
regex_filename_order- the killer feature for real tiled-diffusion use. It parses row and column numbers out of each filename with regexes (regex_rowdefaultr(\d+),regex_coldefaultc(\d+)) and places every tile at its exact grid position. Filenames liketile_r01_c03.pngjust work, regardless of folder sort order.
It also has the blending machinery that makes overlapping tiles look like one image instead of a patchwork - that's the part the tiled-diffusion community cares about, because naive seams are the classic artifact. The overlap_blend modes include average, alpha_over, add, multiply, screen, lighten, darken, weighted, feather_linear, and feather_cosine, controlled by overlap_x/overlap_y, blend_weight, and feather_px. For a seamless stitch, feather_linear or feather_cosine with a reasonable feather_px is the mode you'll actually reach for - the KB's tiled-upscaling notes call out patchwork artifacts as the #1 thing to avoid.
Inputs that matter
folder,glob_pattern- where the tiles are and what they're named.rows,cols- the grid size.order_mode-regex_filename_orderfor robustness, row_major otherwise.overlap_x,overlap_y,overlap_blend,feather_px- seam handling for overlapping tiles.enforce_tile_size+target_w/target_h- force every tile to a uniform size before placing (tiles that don't match get resized).export+filetype/quality/basename/subfolder- whether to also save the result.
Outputs
image - the assembled IMAGE. save_path - the written file path when export is on.
How to install
Part of the orion4d/ComfyUI_DAO_master pack:
cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/ComfyUI_DAO_master.git
pip install -r requirements.txt
Restart ComfyUI. No models.
Common issues
The usual failure is tile placement: if tiles are landing in wrong cells, either your filenames don't match the default r(\d+)_c(\d+) regexes (check regex_row/regex_col and base_index - zero- vs one-based counting is a classic mismatch), or you're on a plain scan order when the folder isn't sorted as expected. Empty canvas? Check glob_pattern actually matches your files. And remember the default export writes a file - if you're seeing an unexpected save, that's the export toggle.
Inputs (28)
| Name | Type | Default | Description |
|---|---|---|---|
| folder | STRING | output/tiles | — |
| glob_pattern | STRING | *.png | — |
| rows | INT | 21–1024 | — |
| cols | INT | 21–1024 | — |
| sort_modeopt | COMBO | name_asc | 4 options: name_asc, name_desc, mtime_asc, mtime_desc |
| order_modeopt | COMBO | row_major | 5 options: row_major, column_major, snake_row, snake_col, regex_filename_order |
| regex_rowopt | STRING | r(\d+) | — |
| regex_colopt | STRING | c(\d+) | — |
| base_indexopt | INT | 00–10 | — |
| fallback_orderopt | COMBO | row_major | 4 options: row_major, column_major, snake_row, snake_col |
| offset_xopt | INT | 0-10000–10000 | — |
| offset_yopt | INT | 0-10000–10000 | — |
| gutteropt | INT | 0-4096–4096 | — |
| overlap_xopt | INT | 00–4096 | — |
| overlap_yopt | INT | 00–4096 | — |
| overlap_blendopt | COMBO | last | 13 options: last, average, alpha_over, add, multiply, screen, +7 |
| blend_weightopt | FLOAT | 0.500–1 | — |
| feather_pxopt | INT | 00–2048 | — |
| enforce_tile_sizeopt | BOOLEAN | true | — |
| target_wopt | INT | 00–8192 | — |
| target_hopt | INT | 00–8192 | — |
| exportopt | BOOLEAN | true | — |
| filetypeopt | COMBO | png | 2 options: png, jpg |
| qualityopt | INT | 951–100 | — |
| basenameopt | STRING | mosaic_from_folder | — |
| subfolderopt | STRING | — | |
| bg_coloropt | STRING | #000000 | — |
| bg_alphaopt | INT | 00–255 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| save_path | STRING | — |