PJ 图像切片原位还原器
Put your edited tiles back in place — seam-free, and nothing else moves
- 基底原图
- 批次替换图片
- 块1_图片
- 块2_图片
- 块3_图片
- 块4_图片
- 块5_图片
- 块6_图片
- 块7_图片
- 块8_图片
- 块9_图片
- 块10_图片
- 块11_图片
- 块12_图片
- 块13_图片
- 块14_图片
- 块15_图片
- 块16_图片
- 块17_图片
- 块18_图片
- 块19_图片
- 块20_图片
- 块21_图片
- 块22_图片
- 块23_图片
- 块24_图片
- 块25_图片
- 块26_图片
- 块27_图片
- 块28_图片
- 块29_图片
- 块30_图片
- 还原后图像
- 替换区域遮罩
- 还原汇总信息
So you sliced a big image into a grid, upscaled or re-inpainted one tile in glorious high resolution, and now you face the part everyone dreads: putting it back without a visible rectangle where you pasted. PJ_Image_Slice_Reassembler (pongjoo/ComfyUI-PJLatent, menu "PJ_Nodes/Image") is the return half of the pack's slice-edit-stitch loop - it reads the exact tile coordinates from the slicer, drops your edited tiles into their original spots, and feathers the seams with a cosine blend so the patch reads as part of the image rather than a sticker.
This is the same philosophy as the crop-and-stitch pattern that's become the community default for region edits: never pass unchanged pixels through a VAE, composite only what you actually changed. Here it's grid-shaped and manual - you decide which tiles deserve a redo.
Feeding it is two wires and a choice. Connect 基底原图 (the base image - the slicer's 原图 output or your original upstream) and 切片数据 (the slicer's coordinate JSON, verbatim; the input's tooltip is explicit about which port to use). Then say which tiles you changed:
- Direct slots:
块1_图片…块30_图片, mapped by index - wire your edited块5_图片result into块5_图片and it replaces tile 5. No per-slot target numbering to set; the port number is the tile number. - 批次替换图片 + 批次对应块序号 - for many tiles at once. The order field is a small parser in its own right:
"5","2, 5, 8","1-3, 5"(ranges and lists), or"全部". Images land on the listed tiles in sequence.
The two settings that decide quality:
- 边缘羽化像素 (feather) - the blend width in pixels; 0 is a hard edge. The tooltip's recommendation of 12–32 matches the community's mask-blur wisdom: too little shows seams, too much bleeds the patch into its neighbors. The feather is a cosine S-curve applied only on seams that touch another tile - edges sitting on the image's outer border stay crisp, so you don't get a faint halo around the whole reassembled image.
- 分辨率处理模式 (resolution mode) - three behaviors. Default scale the replacement back to the original slice size (keeps base resolution - right for a same-size inpaint). The standout is upscale the whole canvas proportionally to the highest tile magnification: if one tile came back 2× or 4× from a super-resolution pass, the entire composite grows to match and your upscaled detail survives instead of being shrunk away. Third is force-stretch the tile to fit regardless of aspect.
What you get back. Three outputs:
- 还原后图像 - the assembled image (IMAGE).
- 替换区域遮罩 - a MASK marking exactly the composited regions, which is genuinely useful if you want a follow-up pass to only touch where you just edited.
- 还原汇总信息 - a STRING report listing each replacement's coordinates, resolution handling, and which tiles were left untouched. Nice for audits of batch work.
It's also defensive where pasting gets ugly: RGBA replacements have their alpha channel multiplied into the blend (so a tile from a transparent/outpaint pipeline doesn't leave hard edges), and channel/RGB-RGBA mismatches are reconciled rather than crashing.
Honest caveats. No 切片数据 means an error string out the summary port - connect it before anything else. And it's index-based: if you slice with a different cut layout than the data describes, tiles land on the wrong coordinates, so keep the reassembler fed from the same slicer run (or its 原图/切片数据 pair) that produced the tiles.
Install
Part of pongjoo/ComfyUI-PJLatent (MIT). ComfyUI Manager → search "ComfyUI-PJLatent", or:
cd ComfyUI/custom_nodes/
git clone https://github.com/pongjoo/ComfyUI-PJLatent.git
Restart ComfyUI - pure torch/PIL, no models or extra deps. Look for PJ 图像切片原位还原器 under "PJ_Nodes/Image".
Inputs (36)
| Name | Type | Default | Description |
|---|---|---|---|
| 边缘羽化像素 | INT | 160–256 | 切块与周围图像拼接边缘的渐变羽化宽度(像素)。0为硬边缘直接贴入,建议12~32消除缝隙接痕 |
| 分辨率处理模式 | COMBO | 缩放替换块至原切片尺寸 (维持基底分辨率) | 3 options: 缩放替换块至原切片尺寸 (维持基底分辨率), 整图等比高清放大 (自适应替换块最高倍率), 强制拉伸切片区域 |
| 基底原图opt | IMAGE | — | |
| 切片数据opt | STRING | 请连接 PJ 图像交互式智能分割器 的【切片数据】输出端口 | |
| 批次替换图片opt | IMAGE | — | |
| 批次对应块序号opt | STRING | 指定批次替换图片对应的原图切块序号,如 '5'、'2,5,8'、'1-3,5' 或 '全部'。图片将按顺序对号入座 | |
| 块1_图片opt | IMAGE | — | |
| 块2_图片opt | IMAGE | — | |
| 块3_图片opt | IMAGE | — | |
| 块4_图片opt | IMAGE | — | |
| 块5_图片opt | IMAGE | — | |
| 块6_图片opt | IMAGE | — | |
| 块7_图片opt | IMAGE | — | |
| 块8_图片opt | IMAGE | — | |
| 块9_图片opt | IMAGE | — | |
| 块10_图片opt | IMAGE | — | |
| 块11_图片opt | IMAGE | — | |
| 块12_图片opt | IMAGE | — | |
| 块13_图片opt | IMAGE | — | |
| 块14_图片opt | IMAGE | — | |
| 块15_图片opt | IMAGE | — | |
| 块16_图片opt | IMAGE | — | |
| 块17_图片opt | IMAGE | — | |
| 块18_图片opt | IMAGE | — | |
| 块19_图片opt | IMAGE | — | |
| 块20_图片opt | IMAGE | — | |
| 块21_图片opt | IMAGE | — | |
| 块22_图片opt | IMAGE | — | |
| 块23_图片opt | IMAGE | — | |
| 块24_图片opt | IMAGE | — | |
| 块25_图片opt | IMAGE | — | |
| 块26_图片opt | IMAGE | — | |
| 块27_图片opt | IMAGE | — | |
| 块28_图片opt | IMAGE | — | |
| 块29_图片opt | IMAGE | — | |
| 块30_图片opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 还原后图像 | IMAGE | — |
| 替换区域遮罩 | MASK | — |
| 还原汇总信息 | STRING | — |