Nodes/comfy-plasma/AutoContrast
ComfyUI Node

AutoContrast

One-click histogram stretch that rescues washed-out images

By Jordach·Created 3 years ago·Updated 2 years ago· 81
AutoContrast
  • IMAGE
  • IMAGE
cutoff2.00
min_value-1

Every so often ComfyUI hands you a render that looks like it was printed on damp cardboard - all the tones huddled in the middle, no real black, no real white. JDC_AutoContrast fixes exactly that: it takes the image's histogram and stretches it so the darkest pixel becomes black, the brightest becomes white, and everything in between spreads out. One wire, one click, and the mud is gone.

It's the auto-contrast utility from comfy-plasma by Jordach, and it's a textbook "make the image look better with almost zero effort" node.

How it works

Under the hood it's Pillow's ImageOps.autocontrast, which does a histogram stretch per channel. The default settings alone (which is what you'll use most of the time) already fix the typical washed-out case.

The two controls exist so you can tell the stretch to ignore outliers:

  • cutoff (float, 0–100, default 2) - the percentage of the lightest and darkest pixels to clip before computing the stretch. That's the anti-noise knob: a single hot white specular can otherwise drag the whole histogram, and cutoff ignores it. Default 2% is a sensible starting point; raise it if your image has stray bright spots dominating the result.
  • min_value (int, default -1) - when set to -1 it does nothing. Set it to a real value (0–255) and it's passed to Pillow as the ignore background value, so pixels at or below that brightness are excluded from the histogram. Handy if you have a pure-black background you want to preserve rather than let the stretch treat it as something to expand.

Input is IMAGE, output is a single IMAGE you can chain into anything downstream. It operates on the whole frame - there's no per-mask or per-region mode, which is fine because auto-contrast is almost always a whole-image operation.

When you'd reach for it

  • Any time a generation or an img2img pass comes back looking flat and hazy.
  • Before you do color grading on a base image, so your contrast adjustments start from a clean full-range histogram.
  • As a quick "make this printable" step when you're about to save something out and it just needs more punch.

If you want the same idea but more surgical, the pack's JDC_Contrast (Brightness & Contrast) gives you manual contrast gain instead of an automatic stretch. AutoContrast is the lazy version, and for once lazy is correct.

Install

No requirements.txt, no models, nothing to download. ComfyUI Manager → Install Custom Nodes → search comfy-plasma → install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Jordach/comfy-plasma

Restart ComfyUI. It shows up under image/postprocessing.

Common issues

Honestly, this one rarely misbehaves. The thing to watch is cutoff - a high cutoff clips a lot of real pixels and can make an image look hazy or posterized, so if the result feels gray, you've cut too much; drop it toward 0. And remember it's a single-image node, so feed it one frame at a time, not a batch. If your source is already contrasty, auto-contrast will cheerfully stretch it further - there's no auto-detect of "already fine," so judge with your eyes.

Categoryimage/postprocessing

Inputs (3)

NameTypeDefaultDescription
IMAGEIMAGE
cutoffFLOAT2.000–100
min_valueINT-1-1–255

Outputs (1)

NameTypeDescription
IMAGEIMAGE