Nodes/Region Edit Toolkit/图像分区 · 严格坐标合成
ComfyUI Node

图像分区 · 严格坐标合成

The node that refuses to paste your edit in the wrong place — and that's exactly right

By Liu-Bot24·Created 2 months ago·Updated about a month ago· 1
图像分区 · 严格坐标合成
  • original
  • generated_local
  • full_composite_mask
  • full_composite_alpha
  • local_composite_alpha
  • final_image
  • strict_composite_mask
  • difference_preview
  • report_json
x
y
width
height

Every regional-edit pipeline ends the same way: paste the edited crop back onto the original, at the exact spot it came from. That sounds trivial until a crop comes back resized, or shifted, or the mask doesn't line up - and you've silently pasted a face edit four pixels off, or worse, over the wrong part of the image. RegionEditStrictCoordinateComposite is the toolkit's paste node, and its defining personality trait is that it will refuse to run rather than do that. The strictness is the feature.

The mechanism is coordinate validation, enforced hard. It takes original (the full image), generated_local (your edited crop), the full_composite_mask and full_composite_alpha (both at full image resolution), and the geometry x, y, width, height. The first thing it checks: generated_local must have exactly the width and height you declared. If the crop came back a different size, it raises "Generated local shape does not match planned" and stops - which is the correct failure mode, because pasting a mismatched crop is how you get double-edges and ghosting. The source then computes the crop intersection, handles the edge case where your crop pokes past the image boundary, and composites using the alpha as a strict support map (with a subtlety: an 8-bit mask can't represent alpha values below half a byte step, so it floors those sub-byte feather tails before deriving the strict support - that's the kind of pixel-level care that keeps seams from contradicting the threshold logic).

The full_composite_alpha does the heavy lifting - it's a full-image mask marking where the generated pixels actually win. The optional local_composite_alpha lets you supply the alpha at crop resolution instead; if given, the node embeds it into full-image space at the declared coordinates. Feed it x/y/width/height from whichever node planned the crop (the tile planners and RegionEditTilePlanItem output exactly these), and the whole chain stays honest.

Outputs: final_image (the composited result), strict_composite_mask (exactly which pixels came from the generated crop - great for verification), difference_preview (original vs composite as an image, for eyeballing what moved), and report_json.

The README's golden rule applies here more than anywhere: local results entering strict composite must keep the same width, height, and coordinate space as the original crop. If an external editor resized or re-cropped the result, restore it to the original crop dimensions first. This is the single most common way people get bitten by this pack, and this node is designed to make that bite loud instead of silent.

Honest note on the pack's youth: this is new, low-traction software, so you won't find a community FAQ for its failure modes - but you don't need one, because the node tells you what's wrong when it stops. When it refuses to run, the error message names the mismatch. That's better than most paste nodes in the ecosystem.

Install: ComfyUI Manager → Region Edit Toolkit (native-region-tile-planner-merge), or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into custom_nodes, pip-install requirements.txt into ComfyUI's actual Python, restart. The x/y/width/height inputs are forceInput, meaning they're designed to be wired from a planner - type values in at your own risk.

CategoryRegion Edit Toolkit/Composite

Inputs (9)

NameTypeDefaultDescription
originalIMAGE
generated_localIMAGE
full_composite_maskMASK
full_composite_alphaMASK
xINT
yINT
widthINT
heightINT
local_composite_alphaoptMASK

Outputs (4)

NameTypeDescription
final_imageIMAGE
strict_composite_maskMASK
difference_previewIMAGE
report_jsonSTRING