一体节点 · 内部遮罩合成
The three-line blend that keeps your original photo intact
- original
- generated
- mask
- 最终图像
What it is
一体节点 · 内部遮罩合成 - "internal mask compositing". It takes the photo you sent for editing, the image the model generated, and your mask, and returns one image built from the two. Category 创界/临时测试/内部, injected by the ChuangJie console; you don't place it yourself.
Its reason for existing is narrower than "inpainting". When you edit a photo through the console with a mask, the model doesn't see only the masked region - it re-renders the whole frame from its own reference encoding, and the untouched parts can drift: a slight colour shift, a background that's 2% different, compression artifacts that weren't there. This node puts the original back everywhere the mask is black, pixel for pixel, and keeps the model's version only where you painted.
The mechanism, exactly
Three required inputs: original (IMAGE), generated (IMAGE), mask (MASK). One output: 最终图像.
The arithmetic is original * (1 - mask) + generated * mask, with both the generated image and the mask bilinearly resized to the original's dimensions if they disagree, the mask clamped to 0–1, and single-image batches broadcast to match. Types and devices are coerced to the original's, so a mask that arrived as float16 alongside a float32 image won't crash you. The mask is validated against the original batch size, and a channel mismatch between 原图 and 生成图 is rejected with a message rather than a traceback.
That is the entire node. It's a lerp. If you were expecting feathering, a blur radius, or an edge-aware blend, there isn't one - the only softening you get is whatever the mask resampling leaves behind, which for a hard-edged hand-painted mask is nothing at all.
Why the boring version is the right call here
Because the alternative silently damages your photo. Every "smart composite" that blurs the mask seam also lightens the region just outside it, and just outside it is the part of the original you were explicitly preserving. A hard mask means a visible seam in exchange for a guaranteed-exact result everywhere else - and in an instruction-editing workflow, where you're fixing a jacket or swapping a sign, an exact background matters more than a soft seam you'd only notice at 200%.
This is the same argument the inpainting docs make in the other direction: for a re-render loop, blur and denoise are your quality levers, and a composite step that quietly adds its own blur fights them. Keep the blend dumb, put the blending decisions upstream where you can see them.
When it's in your graph
Only on the Qwen Image 2.1 editing path, and only when you attached a mask. No mask, no composite - the console wires the decoded image straight to the output. Which means if you're seeing this node in a debugged prompt and wondering why, the answer is "you drew a mask". Removing the mask from the console's edit panel is the switch that turns it off.
It is registered, so you can right-click-add it from the 创界/临时测试/内部 category and wire it by hand - three inputs, one output, no config. Just don't expect that to keep working forever: the ID ends in Test and the pack treats the whole internal family as a private contract it can rewire between versions. For anything you plan to keep, ComfyUI ships ImageCompositeMasked and the Impact Pack has its own composite/paste variants; the maths under all of them is the same masked paste.
Reading the failure messages
- "生成图通道或批量与原图不一致" - the generated image is a different channel count (RGBA vs RGB, typically) or a batch the mask can't broadcast to. Check what fed
generated. - "遮罩批量与待编辑图片批量不一致" - batched source, single mask or vice versa.
- "图像或遮罩张量结构无效" - something non-standard got wired in, often a latent where an IMAGE belongs, or a mask that's still shaped as a 4D image. The node wants a 3D mask: batch, height, width.
Install
Comes with the pack - no separate package, no model download, nothing to configure.
cd ComfyUI/custom_nodes
git clone https://github.com/lefango/ComfyUI-ChuangJie.git
or search ComfyUI-ChuangJie in ComfyUI Manager, then restart ComfyUI and hard-refresh the browser tab. The only pip dependencies in the pack are for GGUF model loading (gguf, sentencepiece, protobuf), and this node needs none of them - it's pure torch.
One upgrade note, since it bites people on the masked-edit path specifically: the console's size handling has been patched more than once (0.5.11 fixed 8-pixel alignment after an image was auto-scaled, 0.5.22 started compressing oversized style covers). If you masked-edit and get a size or PromptStage validation error, git pull in the plugin folder before you start editing masks by hand.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| original | IMAGE | — | |
| generated | IMAGE | — | |
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 最终图像 | IMAGE | — |