Nodes/ComfyUI-DonutNodes/Donut Auto Gamma (DEPRECATED)
ComfyUI Node

Donut Auto Gamma (DEPRECATED)

Four ways to auto-correct exposure, from fast mean-shift to histogram science

By DonutsDelivery·Created about a year ago·Updated about 12 hours ago· 25
Donut Auto Gamma (DEPRECATED)
  • image
  • image
  • gamma
methodgslf
strength1.0
target0.50
percentile50
directionboth

Dark image? Flat image? DonutAutoGamma looks at the image, decides how much gamma correction it needs, and applies it - no eyeballing a slider. It's the auto-exposure member of the pack's image-correction trio (alongside auto white balance and histogram stretch), and it gives you four detection methods to choose from.

Gamma, to be clear, is a power curve: output = input ^ gamma, which lifts shadows or crushes them without moving the white point. That's the "proper exposure" feel - not the wash you get from additive brightness, which is a different operation entirely (a distinction the post-processing world cares about a lot). This node computes the gamma exponent from the image itself instead of asking you to pick one.

The inputs: image, a method dropdown with four options, strength (default 1.0 = full correction), and three optional ones - target (0.5, used by simple_mean and percentile), percentile (50, for the percentile method), and direction (both, brighten_only, darken_only). Outputs are the corrected image and a gamma FLOAT, the exponent it actually applied - wire that into a text node if you want to audit or reuse it.

The four methods, decoded

  • simple_mean - fastest. Shifts the mean brightness toward 0.5. Good enough for most photos.
  • iagcwd - deviation-based, from Cao et al. (2018). Uses how far the mean sits from an "ideal" 0.439 and a quadratic scaling. Middle ground.
  • gslf - the default, and the sophisticated one: histogram-based with a trained polynomial, from the GLAGC line of papers (Rahman et al., 2021). Better on tricky lighting, slower.
  • percentile - robust to outliers. Shifts the p-th percentile (default 50th) to target instead of the mean, so a blown-out highlight or a dark corner doesn't drag the whole correction.

The direction option is the pragmatic one: brighten_only for the common "AI image came out underexposed" case, darken_only for the washed-out case, both for general use.

The honest verdict

This node is DEPRECATED - it was folded into the pack's DonutImageAdjust multipurpose node (which exposes the same four methods plus gamma, white balance, and histogram stretch in one place). The standalone node still runs in old workflows, but new graphs should use DonutImageAdjust with auto_gamma selected. Nothing is lost; it's a consolidation, not a removal.

When to reach for it: as a finishing step after generation, where a cheap deterministic power curve beats re-running the sampler - the post-processing doc's core lesson, "reach for the cheap primitive before the expensive generative one," applies perfectly. Apply white balance first (color casts distort the brightness readings), then auto-gamma, then maybe a histogram stretch. And start with gslf on both; switch to simple_mean only when you're batch-processing a lot of images and speed matters.

Install: pack-wide - ComfyUI Manager → search DonutNodes, or git clone into custom_nodes/ plus pip install -r requirements.txt with the same Python as ComfyUI. Pure torch math on the image tensor, so no model downloads and no GPU drama.

Categorydonut/image

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
methodCOMBOgslfDetection method: simple_mean (fastest), iagcwd (deviation-based), gslf (histogram-based, most sophisticated), percentile (robust to outliers)
strengthFLOAT1.00–2Correction strength (1.0 = full correction)
targetoptFLOAT0.500.1–0.9Target value for simple_mean and percentile methods
percentileoptFLOAT501–99Which percentile to target (percentile method only)
directionoptCOMBObothboth: auto brighten/darken, brighten_only: only brighten dark images, darken_only: only darken bright images

Outputs (2)

NameTypeDescription
imageIMAGE
gammaFLOAT