Nodes/LanPaint/LanPaint Sampler Custom
ComfyUI Node

LanPaint Sampler Custom

Think-mode inpainting inside the custom-sampling graph

By scraed·Created about a year ago·Updated about a month ago· 1,285
LanPaint Sampler Custom
  • model
  • positive
  • negative
  • sampler
  • sigmas
  • latent_image
  • output
  • denoised_output
add_noisetrue
noise_seed0
cfg8.0
LanPaint_NumSteps5
LanPaint_PromptMode
LanPaint_InfoLanPaint Custom Sampler.

If you've outgrown the all-in-one KSampler and moved to ComfyUI's custom-sampling nodes - where the sampler and the sigma schedule are separate pieces you plug together - this is LanPaint's node for that world. It's the same "think before you denoise" inpainting trick as LanPaint's KSampler, but shaped like ComfyUI's stock SamplerCustom: you bring your own SAMPLER and your own SIGMAS, and LanPaint wraps masked inpainting around them.

Why bother? Because the interesting samplers live in the custom-sampling graph. Once you're feeding in a SAMPLER object, you can hand it anything a sampler-select node produces - including the RES4LYF solvers (res_2m, res_2s and friends) that have become where sampler tuning actually happens for flow-matching models like Flux, Z-Image and Wan. This node lets you keep those and still get LanPaint's masked conditioning on top. It was contributed to the pack in mid-2025 specifically to bring LanPaint to the SamplerCustom crowd.

How it works

Same mechanism as the rest of the pack: before each denoise step, it runs a few Langevin-dynamics "thinking" iterations that reconcile the masked region with the fixed unmasked context, then lets your chosen sampler take the step. The difference from the KSampler node is purely structural - the sampler algorithm and the noise schedule arrive as inputs from other nodes instead of being dropdowns on this one. That modularity is the point. LanPaint doesn't care which sampler you plug in; it adds the inpainting reasoning around whatever you chose.

The inputs and outputs that matter

This node exposes far fewer LanPaint knobs than the Advanced sampler - deliberately, since you're meant to be tuning the sampling elsewhere in the graph. What you wire and set:

  • sampler (a SAMPLER) and sigmas (a SIGMAS) - the two custom-sampling inputs. sampler comes from something like KSamplerSelect or a RES4LYF sampler node; sigmas comes from a scheduler node (BasicScheduler, or the pack schedulers). Get these wired and you're most of the way there.
  • model, positive, negative, latent_image - the usual suspects. The latent carries your image and its mask.
  • LanPaint_NumSteps - thinking depth, default 5. Your main quality/speed dial, and here it's basically the only LanPaint dial, so it does a lot of work.
  • LanPaint_PromptMode - Image First (fill from context) vs Prompt First (lean on the prompt). Also there's a cfg (default 8) and an add_noise toggle.

Two outputs: output (the sampled LATENT, send it to VAE Decode) and denoised_output (the fully-denoised preview LATENT, handy for a clean look at the result mid-graph).

How to install it

ComfyUI Manager: search "LanPaint", install, restart - or "Install via Git URL" with https://github.com/scraed/LanPaint.git. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/scraed/LanPaint and restart (ComfyUI newer than 0.3.11). No models or heavy dependencies for the node - but if you're going to feed it RES4LYF samplers, you'll need that pack installed separately too. The node lands under "sampling/custom_sampling".

Common issues & troubleshooting

  • "Where's Lambda / Friction / StepSize?" They're not on this node. The basic Sampler Custom only exposes NumSteps and PromptMode. If you need the full stability trio, use LanPaint Sampler Custom (Advanced) or the LanPaint KSampler (Advanced) instead.
  • Karras or exponential schedule on a Flux/Z-Image base. Don't. Flow-matching models fail on those schedules across the board - use beta or simple. This is a scheduler mistake, not a LanPaint one, but it'll wreck your inpaint just the same.
  • Soft mask, ignored prompt, slow runtime. Same pack-wide rules as everywhere: binary masks (max hardness), describe the masked content in the prompt, and remember NumSteps multiplies your generation time.
  • Flux looks degraded. LanPaint struggles on distillation models - keep Flux guidance low (1.0–2.0). Note Prompt First mode does nothing on Flux, since it has no CFG to flip.
  • Unmasked region drifted. Composite it back with LanPaint Mask Blend if you need those pixels untouched.
Categorysampling/custom_sampling

Inputs (12)

NameTypeDefaultDescription
modelMODEL
add_noiseBOOLEANtrue
noise_seedINT00–18446744073709550000
cfgFLOAT8.00–100
positiveCONDITIONING
negativeCONDITIONING
samplerSAMPLER
sigmasSIGMAS
latent_imageLATENT
LanPaint_NumStepsINT50–100Number of steps for Langevin dynamics, representing turns of thinking per step.
LanPaint_PromptModeCOMBOImage First: prioritizes image quality; Prompt First: prioritizes prompt adherence.
LanPaint_InfoSTRINGLanPaint Custom Sampler.For more info, visit https://github.com/scraed/LanPaint. If you find it useful, please give a star ⭐️!

Outputs (2)

NameTypeDescription
outputLATENT
denoised_outputLATENT