KSampler (Recenter)
A KSampler that pulls color back to neutral while it samples
- model
- positive
- negative
- latent_image
- LATENT
Some checkpoints have a personality. They're sharp, they're fast, and they push every image into a warm haze or a greenish cast. You can fix it with a VAE swap, or you can fix it in post - but the cleanest fix is to stop the drift at the source. Center Sampler (shown in the UI as KSampler (Recenter)) is a drop-in replacement for the normal KSampler that recenters the latent channels during sampling, pushing your output toward a neutral, balanced, and contrasty color. No second pass, no filter.
It's the flagship node of the early Haoming02/comfyui-diffusion-cg ("Diffusion CG") pack - the ComfyUI port of the author's sd-webui-diffusion-cg extension for A1111.
How it works
A normal diffusion run takes a latent of pure noise and refines it step by step. This node does the same loop as ComfyUI's KSampler - same samplers, same schedulers - but it wraps the sampling callback. At each step, before the model's output is handed back, it recenters each of the 4 latent channels toward a target mean:
x[channel] += (target_mean[channel] - x[channel].mean()) * strength
Pull the mean of a channel up or down and you shift the color balance of the final image, because a cast is exactly that: channel means sitting off the neutral point. The C, M, Y, K inputs are your target means (loosely named after CMYK as a color metaphor - they are not real CMYK percentages, a confusion the author's issue tracker has fielded before).
The inputs that matter
Everything a KSampler has: model, seed, steps, cfg, sampler_name (the full ComfyUI list), scheduler, positive, negative, latent_image, denoise. Then the extras:
- strength - 0 to 1, default 0. How hard the recenter effect bites. Zero = the node behaves like a plain KSampler.
- C (default 0.0126), M (default 0.5152), Y (-0.1278), K (0) - the target mean for each channel. The defaults are the author's empirically-derived values for what a neutral SD 1.5 image's channels should sit at. Raising strength with the defaults running gives you the "kill the cast" effect; tweaking individual values steers color by hand.
Output is a single LATENT, wired to VAE Decode exactly like a normal KSampler's.
A note on versions
Center Sampler is from the early era of this pack. The current v2 rewrite dropped the standalone sampler nodes in favor of the single Diffusion CG node (which applies recenter + normalization to whatever KSampler you already have, so you keep your own sampler and scheduling choices). If you install the pack today and can't find Center Sampler, that's why - use Diffusion CG instead, or pin an older release of the pack if you specifically want this all-in-one sampler.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Haoming02/comfyui-diffusion-cg
Restart ComfyUI. Zero dependencies, no model downloads.
Gotchas
- Not all samplers work. The pack's README warns about this, and the issue tracker confirms LCM-style / Turbo-style setups are the usual offenders. If you see no recentering effect, switch sampler.
- Because it's a full KSampler replacement, you lose nothing - but you also inherit whatever sampler/scheduler combo you pick, so set them deliberately rather than leaving
eulerin by default.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 8.00–100 | — |
| sampler_name | COMBO | 22 options: euler, euler_ancestral, heun, heunpp2, dpm_2, dpm_2_ancestral, +16 | |
| scheduler | COMBO | 6 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | — | |
| denoise | FLOAT | 1.000–1 | — |
| strength | FLOAT | 0.00–1 | — |
| C | FLOAT | 0.0126-1–1 | — |
| M | FLOAT | 0.5152-1–1 | — |
| Y | FLOAT | -0.1278-1–1 | — |
| K | FLOAT | 0.00-1–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |