2🐕Local sampler
One mask, and the pixels outside it never move
- model
- image
- vae
- mask
- positive
- negative
- LATENT
- IMAGE
- LocalIMAGE
- PartialMask
If you've inpainted in ComfyUI before, you know the drill: paint a mask, hand the whole image to a KSampler, and hope the bits you didn't touch come back close to what they were. They usually don't - the VAE encode/decode round trip alone chews up the untouched pixels, which is exactly why the crop-and-stitch pattern won: it never runs the unmasked part through the VAE at all. EGCYQJB, the "2🐕Local sampler," is that idea in a single node. It crops to your mask, redraws only that region at a resolution you choose, and pastes the result back onto the original image. The behavior is exactly right: outside the mask, the output is pixel-identical to what you fed in.
How it works
Unlike a plain KSampler you hand it an IMAGE, a MASK and a VAE, and it does the encode itself. The sample() path is a four-stage loop:
- Crop.
mask_crop()finds the bounding box of your mask's white pixels, pads it byRegion_Extension, and scales the crop so its short side equalsPartial_size(512 by default). - Encode. It builds a latent with a proper noise_mask. In
Fillingmode it flattens the non-mask area of the crop to flat 50% gray before encoding, so the model treats it as "generate here, ignore the rest" - the WebUI-style inpaint-only-masked trick.Original_imagekeeps the real pixels there as context instead. - Sample.
common_ksampler()calls the realcomfy.sample.sample()- actual KSampler, actual schedulers, all 34 sampler names. - Stitch. The decoded crop is pasted back at the original coordinates, with
Mask_FeatherGaussian-blurring the composite mask so the seam doesn't scream.
That paste-back-from-original step is the whole point. The README's own demo shows it: a normal redraw mangles the untouched area, this one restores it from the source pixels. If it reminds you of Inpaint Crop & Stitch, you're right - same philosophy, fewer moving parts.
The inputs that matter
The plumbing - model, vae, image, mask, positive, negative, sampler_name, scheduler, steps, cfg, seed - is a normal KSampler's. The knobs that actually do the work:
- Partial_size (512): the resolution the masked region is redrawn at. Crank it for detail, drop toward 384 to keep VRAM happy. Smaller crops get upscaled to fit it, so going above ~768 rarely buys you anything.
- denoise (default 0.35): low by design, because you're replacing a region, not re-rolling the image. Raise it for a full divergence from what's there, keep it low to blend.
- Redraw_Mode:
Fillingblanks the area around the mask before sampling;Original_imagefeeds the original pixels in as context. Start with Filling; switch when the surroundings need to anchor the new content. - Region_Extension (50): padding around the mask so the redraw gets breathing room.
- Mask_extension (6): grows the mask before sampling - handy if your paint job is sloppy.
- Local_Only (on): toggles between two nearly identical stitch routines. Leave it on.
- TEXT: decorative. It's the author's watermark ("2🐕") and does nothing to the output.
Outputs and wiring
- LATENT - the sampled latent of the crop. Chain it or ignore it.
- IMAGE - the full image with the redrawn region pasted back. This is the one you preview and save.
- LocalIMAGE - the raw decoded crop before stitching. Great for checking what the model actually made.
- PartialMask - the feathered mask, useful if you want to feed the same region somewhere else.
For ControlNet, pair it with EGCYQJBCJ (2🐕Local Image) from the same pack: crop your lineart/pose control to the same region or the control and the sample won't align. The pack ships a lineart workflow showing exactly that wiring.
Installing it
ComfyUI Manager → search "Comfyui-ergouzi-samplers", install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/11dogzi/Comfyui-ergouzi-samplers
# then restart ComfyUI
Dependencies are torch, numpy, colorama and pillow - everything ComfyUI already ships - so no model downloads and no heavy install. One heads-up: the module imports torchvision without declaring it, which works only because ComfyUI bundles it. The author, 11dogzi ("二狗子", Ergouzi), is a Chinese Bilibili creator who also makes slider nodes and the HYPIR upscaler; the README is Chinese-first with a rough machine translation, and the code prints a colorful greeting banner to your console on import. Harmless - don't panic at the colors.
Where people get burned
- Empty mask = crash. If your mask has no white pixels, the internal crop returns a differently-shaped tuple and the node throws. Make sure whatever painted your mask actually painted something.
- VAE mismatch. Feed the wrong VAE for your checkpoint and the redrawn region comes out as noise or flat color - the usual ComfyUI rule, no exceptions here.
- Don't read denoise like a txt2img sampler. 0.35 is the sensible start; 0.8+ with Filling mode tends to make the region ignore its surroundings and wander.
- It's a 2024 pack that's barely maintained. If a ComfyUI update breaks it, look for a fork rather than waiting on the author.
This is the node you reach for when you want "fix just this bit" and can't be bothered to bolt Inpaint Crop + KSampler + Stitch together yourself. It's rough around the edges, but the core promise - untouched pixels stay untouched - it keeps.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| image | IMAGE | — | |
| vae | VAE | — | |
| mask | MASK | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 8.00–100 | — |
| sampler_name | COMBO | 34 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +28 | |
| scheduler | COMBO | 9 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform, +3 | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| denoise | FLOAT | 0.350–1 | — |
| Redraw_Mode | COMBO | 2 options: Original_image, Filling | |
| Mask_extension | INT | 60–64 | — |
| Local_Only | BOOLEAN | true | — |
| Partial_size | INT | 5120–2048 | — |
| Region_Extension | INT | 50 | — |
| Mask_Feather | INT | 50–100 | — |
| TEXT | STRING | 2🐕 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |
| IMAGE | IMAGE | — |
| LocalIMAGE | IMAGE | — |
| PartialMask | MASK | — |