Gamma Correction

Gamma Correction

Gamma correction is the process of adjusting the brightness of an image so colors appear correctly on-screen. The light from each pixel on your screen has a different intensity — just like natural light. Let’s explain how gamma correction comes into play.

What Is Gamma Correction?

Our perception of the intensity of light is not linear. Gamma encoding, or more generally the use of transfer functions, is a commonly applied technique to signal and store light intensities with a more effective use of the available precision bits. Without it, all images and displays with 8-bit color depth would suffer from severe color banding artifacts: there would not be enough precision in the darks and mid-tones, since most of the signal space (most of the 16.7 million colors of 8-bit RGB) would be allocated to bright colors.

In a camera, an OETF (opto-electrical transfer function) is used to convert the linear light captured by the camera sensor to, for example, 8-bit sRGB values. Displays use an EOTF (electro-optical transfer function) to convert these gamma-encoded signal back to linear light.

Gamma correction, i.e. taking into account the opto-electrical and electro-optical transfer functions, is an essential part of any image or video processing chain in order to do correct color conversions. More broadly, the term can also refer to artistic or corrective modifications to the brightness curves of an image or video.

A pure gamma function is power function of the form x𝛄, and gets its name from the Greek letter 𝛄 (gamma) which is the constant in the exponent of this function. For example, a typical example is 𝛄=2.2, which means that a signal value of x, on a relative scale going from 0 to 1, gets converted by the EOTF to a linear light intensity proportional to x2.2. The corresponding OETF then is x1/2.2.

Why Does Gamma Correction Matter?

Gamma correction ensures that what you see on your screen is what the camera sees, or at least a reasonable reconstruction within the capabilities of the display technology. This involves mapping input values through a correction function tailored to the display device’s characteristics. It’s also essential to make sure that colors are displayed accurately. If you have a bright red shirt in real life and want to show it off, using a workflow where gamma correction is properly applied will help ensure that the color doesn’t look washed out or dull when it’s bright and vibrant in reality.

Gamma Correction

Gamma correction can also be used to control the overall brightness of an image, making it an invaluable tool for fixing images that are too dark or bleached out, together with other color manipulations like contrast or saturation adjustment. For example, the e_brightness effect effectively applies an additional gamma curve in order to globally brighten or darken the image manually.

Enhance Your Images with Cloudinary

It is easy to accidentally implement image processing workflows that do not properly take gamma correction into account, and color management in general. This can lead to inconsistencies in the way images are rendered when viewed on different displays or in different viewers or web browsers.

With Cloudinary’s media optimization, we automatically compress images using the optimal encoder for the task, ensuring correct color processing. There are also plenty of features available to automatically enhance or fix images that may have been created or processed with poor color accuracy, e.g. user-generated content. You won’t need to worry about sacrificing image quality for performance – Cloudinary takes care of it with our Media Experience Cloud.

If you want to start optimizing your media, try Cloudinary. You can sign up for free today!

Additional Resources You May Find Useful:

Last updated: Apr 23, 2025