Gamma Correction
The single number that brightens or darkens an image's mids
- image
- image
Gamma Correction is the most surgical of the pack's grading nodes: one input, one slider, one output. It applies a power-curve to the image - out = in^(1/gamma) - which brightens or darkens the midtones while leaving black and white largely alone. Where BrightnessContrast shifts everything uniformly, gamma rescues the middle of the tonal range without blowing your highlights or crushing your shadows. It's the difference between "turn the whole image up" and "lift the mids."
How it works
The math is np.power(img, 1.0/gamma), clamped to [0,1]. Gamma = 1.0 is neutral (a power of 1 does nothing). Values above 1.0 brighten the midtones - because the exponent 1/gamma is less than 1, which lifts dark values toward the top of the curve. Values below 1.0 darken them. That's the mental model to hold: gamma above 1 = brighter mids, gamma below 1 = darker mids. It's the inverse of the display-gamma convention people carry from monitors, where higher gamma means darker - here the node computes on the image's encoded values, so up is up.
The input that matters
- gamma - 0.1 to 5.0, default 1.0 (neutral). This is the whole node. Realistic adjustments live in a narrow band: 0.8–1.2 is subtle correction, 1.3+ is a strong lift, 0.7 and below gets murky fast. If you find yourself past 1.5 or below 0.6, you're probably not fixing a gamma problem - you're fixing an exposure problem, and
BrightnessContrastis the better tool.
Why you'd reach for it
Two recurring ComfyUI cases. First, a generated image that reads slightly "milky" - the classic symptom of an image that's been through an sRGB-encoded pipeline and looks flat. A gamma lift (1.15–1.3) de-milks it cleanly, because it re-brightens the mids that the encode crushed. Second, matching the tonal weight of a reference: gamma down to flatten a too-punchy output, gamma up to bring out shadow detail. It's also the honest low-tech alternative to the pack's profile-based linearization - if you just want an image to look less flat without caring about actual linear light, this is the quick version.
Install
Part of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/APZmedia/ComfyUI-color-tools
Or ComfyUI Manager → search "ComfyUI Color Profile Reader" → Install → restart. Note the README's manual clone URL is a placeholder (yourusername/...) - the real repo is APZmedia/ComfyUI-color-tools. This node is tensor-only (no file-mode toggle, unlike some siblings) and needs just numpy, which ComfyUI already ships - so it's one of the most dependency-light nodes in the whole pack. Even if some optional deps failed to install, this one should still be in your list.
One workflow tip to close: gamma and temperature stack cleanly. Gamma sets the tone curve, then ColorTemperature sets the mood, and you've got a two-node grade that covers the majority of casual color fixes without touching curves or LUTs.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| gamma | FLOAT | 1.000.1–5 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |