Levels (Filter)

Share

What is the "Levels" Filter in Image Editors?

Levels is a filter commonly found in image editors that allows you to quickly control the levels of brightness of an image, in particular, it lets quickly make dark gray into black, or light gray into white, by controlling the input levels; and you can also do vice-versa by controlling the output levels: turning black into dark gray, or white into light gray. The levels filter "shifts" these four extremes so you can quickly modify the range of values that a layer has.

A screenshot of krita levels filter settings as shown in the new filter mask dialog.
A screenshot of Krita's "Levels" filter settings as shown in the new filter mask dialog. The graph shown is the histogram of the current layer. It tells us that there are no fully black pixels or fully white pixels, and there are more dark pixels (the high amount at the left) than light pixels.

Histogram of Levels Filter

The levels filter normally displays a histogram of the image or layer affected by the filter. This histogram can tell us what is the darkest "level" and brightest "level" currently in the image. If you want to make sure that the dark areas of your image are black and the bright areas are white, you should simply move the input levels' control points to "clamp" the input to levels that actually exist in the image, and then the filter will "stretch" them to fit the output levels.

Gamma of Levels Filter

The levels filter also typically has a middle value for the gamma factor. When the gamma is 1.0, the default, it linearly interpolates between the two extremes. We can use other values to quickly control the brightness of the image. In practice, if you ever need to apply a gamma function to an image, this is probably the easiest method in most image editors.

Tricks

The levels filter is extremely useful in combination with filters that operate on lightness levels, such as Gradient Map and halftone generators.

A step by step comparison of various filters used in Krita to create a halftone effect. From left to right: the original photo, the photo with the halftone filter applied, then with levels filter also applied, and finally with desaturate (max) also applied.
An example of the halftone effect created in Krita by combining the Hafltone filter, Levels filter, and Desaturate filter together. Photo: birdsaspoetry.com via Flickr.
A photo of a kitten, next to it a layer structure in Krita that creates a blue and red duotone effect. The structure includes a gradient map, then a levels filter, then a desaturate filter, and finally the photo of the kitten.
The layer structure of a duotone effect created in Krita. Photo: Stephen Rahn via Flickr.
Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments