Eric Krea2 Paint Composite
The one node that guarantees the rest of the image didn't move
- image
- paint
- IMAGE
Every inpainting guide eventually arrives at the same piece of advice: composite after inpainting. Don't let the decode/encode cycle, or the model's own idea of "close enough", touch pixels you didn't ask it to touch. It's not paranoia - the classic version of this mistake is chaining three or four uncomposited passes and discovering you've turned a good image into mush.
Eric Krea2 Paint Composite is that composite, done properly for this pack: it pastes the source back outside the mask with a feathered inward edge, using the bookkeeping the Paint node already did. It's the optional second half of the paint pair.
How it works
It's a small function with a specific job. It takes the generated result and the paint bundle, rescales the bundle's known-region mask and the source pixels to the result's resolution, then blends: out = result * (1 - alpha) + known * alpha, where alpha is 1 in the kept region and falls off over feather_px inward from the kept-region edge. The feather is computed by growing the generated mask with a max-pool and then averaging it, so the transition is a smooth ramp rather than a hard line you'd see on flat backgrounds.
Nothing clever, nothing learned, no VAE round-trip - which is the point. This is a pixel copy, and the only pixels it overwrites are ones the model was asked to invent.
The one thing it prints is a warning: if the source is smaller than its area in the final result, those pasted pixels are upsampled and may look softer than the generated image around them. It'll say so in the console rather than letting you find out at 100% zoom.
Inputs and output
Two required: image - the generated result, at whatever stage size you're handing it - and paint, wired from the Eric Krea2 Paint node. One optional knob, feather_px (default 32, max 512), measured in canvas pixels and scaled to the result.
Output is a single IMAGE. Nothing exotic. Wire it to your save node.
That's the whole node, so here's the judgement call instead: do you need it? For the AnyPaint adapter, mostly no. AnyPaint pins the kept region inside the sampler, so the generated output already holds the source there and a second paste is redundant. It earns its place in three situations. Outpaint-adapter runs, where this paste-back is the adapter's own post step. Any time you've resized, upscaled or otherwise moved the result after generation and want the source restored at its native resolution. And the case the knowledge base calls out as masking's remaining unique advantage - when unmasked pixels must be bit-identical, not merely close.
Installing it
It ships with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Krea2_ComfyUI_Advanced
or ComfyUI Manager → search Eric_Krea2. The pack needs a diffusers build that includes Krea2Pipeline, installed from source because the version string didn't move when Krea 2 support merged:
python_embeded\python.exe -m pip install --upgrade --force-reinstall --no-deps git+https://github.com/huggingface/diffusers.git
You also need transformers>=4.57.0 and Krea 2 weights in diffusers layout. The composite node itself is torch tensor math and would run without any of that - but it's only useful downstream of a Paint run, so in practice you're setting up the whole stack anyway.
Gotchas
Wire it on the final result, not a mid-chain one. The bundle carries the canvas geometry, and the node scales masks and source to whatever image you hand it, so a stage-1 latent-side result isn't what you want to composite.
A visible seam means feather_px is too low, not that the model failed. Thirty-two pixels is fine for most work; on flat skies and studio backdrops you can often push it lower and still get a clean blend, and on textured backgrounds a wider feather hides the transition better.
If the pasted region looks flat or plasticky, that's the source resolution talking, not the node - you've preserved an area smaller than its place in the image, and upsampling a small region never looks like native detail. Generate the region you're keeping at the size it'll occupy, or let a later upscale pass handle the whole frame together.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | The generated result (any stage size). | |
| paint | KREA2_PAINT | — | |
| feather_pxopt | INT | 320–512 | Inward feather from the kept-region edge, canvas pixels (scaled to the result). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |