Seedream 遮罩贴回原图
Seedream has no mask socket — paste the edit back onto the original yourself
- original
- generated
- mask
- mask_2
- IMAGE
Ask the internet how to inpaint with Seedream and you get the same answer every time: you can't send a mask, so send it the region and paste the result back by hand. "Seedream 遮罩贴回原图" is that paste step, packaged as one node.
Why this exists
Seedream redraws the whole frame, every call. There's no mask input on the API and no way to ask it nicely to leave the rest alone - people hit this immediately, masking a hand or a product label, prompting "change only this," and watching the model re-render the entire scene around it. The community's workaround is well-worn: crop the region, let Seedream edit the crop, composite it back with a feathered mask.
That last step is what this node does, and it's the part everyone reimplements badly. Compositing is also the durable half of the 2026 inpainting split: instruction editors fix things from a sentence, but they can't hand you bit-identical pixels outside the region.
It does not make Seedream respect your mask, though. The model still paints a whole image; you're choosing which pixels survive.
Wiring it
Four sockets matter. original is your untouched source. generated is whatever Seedream returned. mask is the painted region, where white means keep the generated pixels - so the area you want changed is white. mask_2 is optional and gets OR-merged with mask - the practical fix for combining a LoadImage alpha or a saved mask with something you painted in the MaskEditor. One mask is enough; neither is legal, and that's the trap below.
grow (default 8) expands or shrinks the mask before blending, one pixel per step. Positive grows the white area, negative eats into it. blur (default 12) is a Gaussian softness applied to the mask edge - technically a sigma of blur/2, so 12 gives you roughly a 6px falloff. The two defaults are chosen so a normal tight mask blends without a visible ring.
The output is a single IMAGE: original outside the mask, generated inside it, blended across a soft edge. Straight into SaveImage or a preview.
Under the hood it resizes the mask to the original's dimensions, merges the two with a max, runs the grow/blur, then hands both images to ComfyUI's standard masked compositor with source-resizing on - which is why the result comes back at your original's resolution even if the API returned something smaller.
The trap: a forgotten mask
If neither mask is plugged in, or the mask you plugged in is essentially black, the node returns the generated image unchanged. That's deliberate, for full-image edits - but it means a miswired graph doesn't error, it quietly replaces the whole picture. If your output looks like the raw Seedream result and you expected a patch, check the mask wiring first.
Where people get burned
Size mismatch, and the softness that follows. The generated image is bilinearly resized to the original. If you're patching a 4K original with a Seedream output capped around 4.19MP, the pasted region is effectively upscaled and will read a bit soft next to everything around it. Match your original to the output size, or crop the region first so the paste happens at native resolution.
Seams. The default grow/blur handles most cases. If you can see a hard ring, the mask was too tight - raise grow rather than blur, because blur only softens the transition, it doesn't cover pixels the model changed just outside your painted area. If the model re-lit the surroundings slightly, wider blur (24-ish) smooths the join.
Big grow values crawl. The dilation runs on CPU, one full pass per pixel of growth, so grow 200 on a 4K image is two hundred array passes. For feathering, spend your money on blur instead.
scipy missing. The grow/blur math uses scipy.ndimage. ComfyUI's standard environment has it; a stripped venv or hand-built install may not, and then the node fails at import. pip install scipy fixes it.
Install
Same pack as the Seedream input node. ComfyUI Manager → search Seedream Official Input, or the node itself via Seedream 遮罩贴回原图. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/NoNameFaces/ComfyUI-SeedreamOfficialInput
Restart after. No weights, no downloads - nothing beyond the environment ComfyUI already ships.
Reach for it whenever you have a Seedream edit in hand and a specific region in mind. For one eye or one hand, a crop-and-stitch workflow still wins, because the model gets that region at native generation resolution. This node is for when you already ran the call and just need it put back.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| original | IMAGE | Unedited source image. | |
| generated | IMAGE | Seedream output. | |
| grow | INT | 8-256–256 | Expand (positive) or shrink the mask before blending. |
| blur | INT | 120–256 | Gaussian blur on the mask edge, in pixels. |
| maskopt | MASK | White = paste generated pixels. Empty mask = pass generated through. | |
| mask_2opt | MASK | Optional second mask, OR-merged with mask (e.g. LoadImage + Painter). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |