Nodes/ComfyUI-PJLatent/PJ 图像交互式智能分割器
ComfyUI Node

PJ 图像交互式智能分割器

Slice an image into a grid with your mouse, then fix one tile at a time

By pongjoo·Created 7 months ago·Updated 3 days ago· 0
PJ 图像交互式智能分割器
  • 图像
  • 原图
  • 切片数据
  • 全部块_批次
  • 切片信息
  • 块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_图片
上传图片
重叠缝隙像素0
尺寸对齐倍数自动对齐到 8 倍数 (推荐·生图/VAE无损标准)
切线数据{"horizontal": [], "vertical": []}

The crop-edit-stitch pattern is the cleanest way to fix part of a big image: cut out the broken region, re-render or upscale it on its own, paste it back untouched-everywhere-else. That's the idea behind Inpaint-CropAndStitch for one region and automatic detailing for faces - but neither helps when you want a whole grid of tiles to process selectively and return to exact original positions. PJ_Image_Interactive_Slicer (pongjoo/ComfyUI-PJLatent, menu "PJ_Nodes/Image") is the cut half of that workflow, and it's genuinely pleasant to use: you draw cut lines directly on the image inside the node, and it hands you every tile plus the coordinate bookkeeping to put them back.

Getting an image in. Two routes, and the node is happy with either: wire an upstream IMAGE into the 图像 optional input, or use the node's own 上传图片 widget - a native ComfyUI image dropdown with upload, and per the README you can even drag a file straight onto the node canvas.

Drawing the cut. The interactive canvas is where this node earns its name. Small buttons add a horizontal (──) or vertical () cut line; the line follows your cursor, a left-click locks it in place; hold Shift to snap to common percentage stops; click a line (or hit DEL/Backspace) to remove it; the arrow keys nudge a selected cut by 0.1% (1% with Shift, 0.01% with Ctrl). Every cut is stored as a ratio of the image, so the same cut data stays valid if you swap in a differently-sized image later. All of it lands in the 切线数据 widget as JSON like {"horizontal": [], "vertical": []} - you don't type that by hand, the canvas writes it.

The inputs a beginner actually touches:

  • 重叠缝隙像素 (overlap) - how many extra pixels each tile keeps beyond the nominal cut line, for blending later. The tooltip's plain: whether tile edges keep overlap pixels for stitching transitions. 0 for exact tiles; 16-ish if you're going to feather-merge afterward.
  • 尺寸对齐倍数 (align) - snap every tile to a multiple of 8 or 16 (or no alignment). Leave it on 8 的整数倍: SD/Flux VAE encode demands multiples of 8, and the tooltip says it plainly - this stops VAE Encode from force-cropping pixels or erroring on odd sizes. 16 is the video/deep-learning standard if that's your downstream.

What comes out. First four outputs then per-tile ports up to 块30_图片:

  • 原图 - your image, passed through untouched (the natural feed for the reassembler's base input).
  • 切片数据 - the contract: a JSON blob with original dimensions and every tile's pixel coordinates. This is what makes round-tripping possible.
  • 全部块_批次 - all tiles padded to one uniform size in a single IMAGE batch, for processing everything through a batch sampler or VAE at once.
  • 切片信息 - a human-readable text report of each tile's size and coordinates.
  • 块N_图片 - individual tiles, row-major (块1 top-left). Frontend shows only as many as your cuts create; wire just the tiles you intend to process.

Under the hood it's straightforward pixel surgery - ratios become integer split positions, each block is cropped with your overlap extended and edges nudged to the alignment multiple - so it runs instantly with no model involved.

Where it points

The intended loop, and it's the modern regional-fix pattern from inpainting.md applied to a grid: slicer → take 块5_图片, run it through whatever fixes that region (inpainting, an upscaler, a face detailer, a fresh img2img pass) → feed the result to the pack's PJ_Image_Slice_Reassembler with the same 切片数据, and get back a seamless full image where only tile 5 changed. When a whole-image re-render is wasteful or you want specific tiles at genuinely high resolution, this is the manual, controlled version of what automatic detailing does to small regions - you get to pick the region yourself.

Install

Ships in pongjoo/ComfyUI-PJLatent (MIT, Chinese-authored). ComfyUI Manager → search "ComfyUI-PJLatent", or:

cd ComfyUI/custom_nodes/
git clone https://github.com/pongjoo/ComfyUI-PJLatent.git

Restart ComfyUI. No extra deps, no models - the interactive canvas is a small JS extension bundled in the pack. Find it as PJ 图像交互式智能分割器 under "PJ_Nodes/Image".

CategoryPJ_Nodes/Image

Inputs (5)

NameTypeDefaultDescription
上传图片COMBO1 options: example.png
重叠缝隙像素INT00–512切块边缘是否保留重叠像素(用于拼接过渡)
尺寸对齐倍数COMBO自动对齐到 8 倍数 (推荐·生图/VAE无损标准)是否将切块尺寸吸附对齐为8或16的整数倍。杜绝VAE Encode强制裁切丢像素或报错
切线数据STRING{"horizontal": [], "vertical": []}
图像optIMAGE

Outputs (34)

NameTypeDescription
原图IMAGE
切片数据STRING
全部块_批次IMAGE
切片信息STRING
块1_图片IMAGE
块2_图片IMAGE
块3_图片IMAGE
块4_图片IMAGE
块5_图片IMAGE
块6_图片IMAGE
块7_图片IMAGE
块8_图片IMAGE
块9_图片IMAGE
块10_图片IMAGE
块11_图片IMAGE
块12_图片IMAGE
块13_图片IMAGE
块14_图片IMAGE
块15_图片IMAGE
块16_图片IMAGE
块17_图片IMAGE
块18_图片IMAGE
块19_图片IMAGE
块20_图片IMAGE
块21_图片IMAGE
块22_图片IMAGE
块23_图片IMAGE
块24_图片IMAGE
块25_图片IMAGE
块26_图片IMAGE
块27_图片IMAGE
块28_图片IMAGE
块29_图片IMAGE
块30_图片IMAGE