Nodes/ComfyUI-DonutNodes/Donut Image Adjust
ComfyUI Node

Donut Image Adjust

Six tone and color fixes, one node

By DonutsDelivery·Created about a year ago·Updated about 20 hours ago· 25
Donut Image Adjust
  • image
  • image
  • gamma
operationgamma
ag_methodgslf
ag_strength1.0
ag_target0.50
ag_percentile50
ag_directionboth
gm_gamma0
gm_dither0.0
wb_methodgray_world
wb_strength1.0
wb_clip_percent0.1
hs_black_point0.0
hs_white_point100.0
hs_modeluminance
lc_radius20
lc_amount0.20
lc_protect_tones0.0
lc_fast_blurtrue
cas_sharpness0.50
cas_contrast0.0

If you've poked at this pack at all, you've seen the graveyard: DonutGammaCorrection, DonutAutoGamma, DonutAutoWhiteBalance, DonutHistogramStretch, DonutHiRaLoAm, DonutCAS - six image nodes, all marked DEPRECATED. DonutImageAdjust is why. It folds all six operations into a single node behind one operation dropdown, with each operation's parameters namespaced and tucked into the optional block so unused ones never get in your way. This is the node to reach for; the standalone six are kept alive purely so old workflows keep loading.

It's a post-processing workhorse, and the nice thing is how deliberately it's built: every operation reuses the original implementation verbatim - no math was re-implemented, so a local_contrast here is byte-for-byte the old DonutHiRaLoAm.

The operations

  • auto_gamma - detects the exposure and corrects it. Methods: simple_mean (fastest), iagcwd, gslf (histogram-based, "most sophisticated"), and percentile (robust to outliers). Add ag_strength, ag_target, and ag_direction (both / brighten_only / darken_only) to steer it.
  • gamma - the power-curve midtone fix. gm_gamma from -100 to +100 (positive lifts shadows), plus gm_dither to break up banding.
  • white_balance - color-cast removal via wb_method: gray_world, white_patch, combined, auto_levels, or photoshop (per-channel plus midtone snap). wb_strength and wb_clip_percent control the aggressiveness.
  • histogram_stretch - auto-levels, with hs_black_point / hs_white_point percentiles and hs_mode (global / per_channel / luminance).
  • local_contrast - the Clarity-style boost (lc_radius, lc_amount, lc_protect_tones, lc_fast_blur).
  • cas - Contrast Adaptive Sharpening (cas_sharpness, cas_contrast).

The namespacing means you can pre-tune every operation's widgets and switch between them by flipping one dropdown, which is genuinely handy for A/B comparisons on a fixed seed.

The outputs

Two outputs. image is the processed frame. The gamma FLOAT is the diagnostic from auto_gamma - the average gamma it measured, which is genuinely useful feedback when you're dialing in ag_target. For every other operation it's a flat 1.0, so don't build logic on it unless you're in auto_gamma.

Install

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/DonutsDelivery/ComfyUI-DonutNodes.git donutnodes
cd donutnodes
python -m pip install -r requirements.txt

or ComfyUI Manager → "DonutNodes," then restart. No extra models to download - it's pure tensor math, so it runs on the CPU if it has to.

The trap to avoid

The classic post-processing mistake the KB calls out: reaching for img2img to fix contrast when a deterministic pass does it in milliseconds without a seed lottery. These operations are the "proper" fix - gamma, not brightness, for exposure (additive brightness flattens and clips), luminance-mode histogram stretch for flatness, and low-amount local contrast for depth. Chain them: stretch, then gamma, then a touch of CAS, and you've got the whole finishing kit in one node.

Categorydonut/image

Inputs (21)

NameTypeDefaultDescription
imageIMAGE
operationCOMBOgammaWhich image adjustment operation to apply.
ag_methodoptCOMBOgslfDetection method: simple_mean (fastest), iagcwd (deviation-based), gslf (histogram-based, most sophisticated), percentile (robust to outliers)
ag_strengthoptFLOAT1.00–2Correction strength (1.0 = full correction)
ag_targetoptFLOAT0.500.1–0.9Target value for simple_mean and percentile methods
ag_percentileoptFLOAT501–99Which percentile to target (percentile method only)
ag_directionoptCOMBObothboth: auto brighten/darken, brighten_only: only brighten dark images, darken_only: only darken bright images
gm_gammaoptFLOAT0-100–100Gamma adjustment (-100 to +100). Positive brightens shadows, negative darkens them.
gm_ditheroptFLOAT0.00–2Dither amount to reduce banding (0 = off, 0.5 = subtle, 1.0 = 1 LSB worth of noise)
wb_methodoptCOMBOgray_worldgray_world: shift means to gray. white_patch: scale by brightest. combined: both. auto_levels: per-channel stretch (Auto Tone). photoshop: per-channel + midtone snap (Auto Color)
wb_strengthoptFLOAT1.00–2Correction strength (1.0 = full correction)
wb_clip_percentoptFLOAT0.10–10Percent of pixels to clip from brightest/darkest (Photoshop default: 0.1%)
hs_black_pointoptFLOAT0.00–49Percentile for black point (0 = absolute min, 1+ = robust)
hs_white_pointoptFLOAT100.051–100Percentile for white point (100 = absolute max, 99- = robust)
hs_modeoptCOMBOluminanceglobal: bounds from luminance, same stretch to RGB (preserves ratios). per_channel: stretch RGB independently (may shift colors). luminance: LAB L-only (preserves hue/saturation, matches LayerStyle)
lc_radiusoptFLOAT201–200Large radius for local contrast enhancement
lc_amountoptFLOAT0.200–1Keep low to avoid halos (0.1-0.3 typical)
lc_protect_tonesoptFLOAT0.00–1Protect shadows/highlights from clipping
lc_fast_bluroptBOOLEANtrueUse separable blur (faster, identical quality)
cas_sharpnessoptFLOAT0.500–1Sharpening strength
cas_contrastoptFLOAT0.0-1–1Contrast adjustment (0 = neutral)

Outputs (2)

NameTypeDescription
imageIMAGE
gammaFLOAT