Sigmoid Correction
S-curve contrast, minus the guesswork
- images
- IMAGE
Every flat, muddy render you've ever seen is a contrast problem, and the classic photographic answer is an S-curve: deepen the shadows, lift the highlights, leave the middle alone. This node is that S-curve, parameterized so cleanly you'll have it dialed in ten seconds after you try it. It wraps Kornia's adjust_sigmoid, a.k.a. sigmoid (logistic) correction, and it's the most "colorist" node in the ImageProcessing pack - closer to what you'd do in a photo editor than anything else here.
How it works
Instead of a power curve like gamma, sigmoid correction runs every pixel through a logistic function:
out = 1 / (1 + exp(gain * (cutoff − image)))
Squint at that and you can see the shape: values below the cutoff get pushed down, values above it get pushed up, and the middle - where the curve is steepest - gets the most contrast. Two numbers control the whole curve. cutoff (0–1, default 0.5) is the pivot point, the brightness where the curve crosses 0.5; it decides whether the "stretch" happens in the shadows or the highlights. gain (1–10, default 5) is the steepness - how hard the curve pushes apart the midtones. Higher gain equals more contrast, until you hit the asymptotes and the top and bottom of the range start crushing.
The inputs
- images - a ComfyUI IMAGE, typically the VAE-decoded render.
- cutoff (0–1, default 0.5) - the curve's midpoint. Lower it to give shadows more pop; raise it to emphasize highlights.
- gain (1–10, default 5) - contrast strength. Start at 5, nudge from there.
Output is an IMAGE at the same size, ready to flow into your save or upscale chain.
Installing it
It ships in the ImageProcessing pack by bvhari - seven small wrapper nodes around the Kornia library, and this is the most advanced one:
cd ComfyUI/custom_nodes
git clone https://github.com/bvhari/ComfyUI_ImageProcessing
# restart ComfyUI - kornia installs automatically from requirements.txt
Or ComfyUI Manager → Custom Nodes Manager → search "ImageProcessing" → Install → restart. Found under the ImageProcessing category; no models, no keys, CPU-only like the rest of the pack.
When it bites
The failure mode is crushing. The sigmoid is asymptotic, so it never hard-clips like a contrast slider - but push gain to 8–10 and the blacks go blacker-than-photo and the whites go flat, which reads as "muddy" on some monitors. If the image looks dusty or gray afterward, you've pushed past the useful range; back off the gain before touching cutoff. Also note this is global - no mask input, so you can't apply it to only the subject. And since the defaults are deliberately mild (cutoff 0.5, gain 5), "nothing changed" usually means you're hovering near the identity point of the curve - raise the gain a notch and it'll show.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| cutoff | FLOAT | 0.500–1 | — |
| gain | FLOAT | 5.001–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |