AI Glossary / Computer vision and multimodal AI / Beginner

Levels

Definition

Levels is an image-editing adjustment that remaps tonal values using controls for the input black point, input white point, midtones, and output range. It can change contrast, brightness relationships, and individual color channels. In this glossary entry, levels refers to that tonal adjustment, rather than image-pyramid levels or the number of representable intensity values.

What it means

An image may use only a narrow part of its available tonal range. Levels can stretch that range, making dark tones darker and light tones lighter. It can also compress the output range or alter the midtones while keeping the endpoints fixed.

The histogram often displayed with the controls summarizes how many pixels have each tonal value. It helps reveal the distribution, but it does not specify how the photograph should look. A misty scene can correctly have few deep blacks, and a dark scene does not necessarily need bright white highlights.

Levels changes existing values. It cannot recover detail that was never captured or that has already been irreversibly clipped. The visual goal and the available information should guide the adjustment.

How it works

Choose which channel or composite image to adjust. Set the input black and white points to identify the values that map to the selected output endpoints. Values beyond those points are typically clipped to the corresponding endpoint.

Adjust the middle control to alter the tonal mapping between the endpoints. This is commonly implemented through a gamma-like power adjustment, although parameter conventions should be checked in the specific application.

Output controls determine the darkest and lightest resulting values. Raising the output black point can produce lifted shadows, while lowering the output white point reduces the brightest output.

Review both the image and clipping indicators. An adjustment layer or equivalent nondestructive workflow allows revision without repeatedly replacing the original pixel data. Channel-specific changes can affect color balance as well as brightness.

Three practical examples

1. Scan preparation: An editor adjusts the tonal range of a faded document scan to improve readability while checking that faint marks remain visible.

2. Product photography: A studio makes restrained tonal adjustments across a set of images, inspecting actual product colors and avoiding clipped highlights on reflective surfaces.

3. Image-processing education: A student applies a defined levels mapping to grayscale values and observes how stretching a range changes contrast and quantization.

Think of it this way

Think of stretching a short ruler marking range across a longer display scale. Values that were close together become farther apart on the scale, making differences easier to see. The analogy is limited because levels can also use a nonlinear midtone mapping, and clipping can merge distinct input values into the same output value.

Worked example

Consider an eight-bit grayscale adjustment with input black point 50, input white point 200, unchanged midtone setting, and output endpoints 0 and 255. Within that input range, use the linear mapping output = 255 × (input − 50)/150.

An input of 50 becomes 0. An input of 125 becomes 127.5, approximately 128 after rounding. An input of 200 becomes 255. The interval from 50 to 200 is stretched across the full output range.

Values of 20 and 40 both fall below the black point and become 0 under clipping. Their original difference disappears from the adjusted output. Likewise, values above 200 become 255, losing distinctions among those highlights.

If the output endpoints are instead 20 and 235, the midpoint 125 maps to 127.5 again, but the darkest and brightest outputs are restricted to 20 and 235. This demonstrates that input clipping points and output endpoints have different roles. The calculation omits any nonlinear midtone adjustment and assumes a simple grayscale mapping.

Illustrative case study

Fictional case study: A local-history group prepares scanned posters for an online exhibition. A volunteer initially stretches every scan to full black and white using the histogram extremes.

On one faded poster, the stronger setting removes subtle pencil annotations and makes the paper look unlike the original. The group revises its process: it keeps the archival scan untouched, uses adjustable editing layers, and reviews faint markings before approving a display copy.

For some posters, a modest midtone change is enough. Others need more careful local work. The group documents the presentation edits rather than treating a full-range histogram as proof of faithful reproduction. No improvement in archival accuracy is inferred from increased visual contrast alone.

Common misconceptions and mistakes

A histogram that reaches both extremes is not automatically better. The appropriate tonal range depends on the subject and intended presentation.

Moving an input endpoint inward can destroy visible distinctions through clipping. It does not merely move all values by an equal amount.

The middle control is not necessarily the same operation as adding a fixed brightness offset. A nonlinear mapping changes different tones by different amounts.

Levels is not identical to histogram equalization. Levels uses a small set of controls to define a mapping, while equalization constructs a mapping from the value distribution.

Repeated destructive adjustments, especially with limited numerical precision, can introduce gaps or banding. Preserve a high-quality original and avoid unnecessary cycles of remapping and rounding.

Business use

Levels is useful for straightforward tonal correction and as a transparent preprocessing operation when its mapping is documented. It offers a small number of understandable controls, making it easier to reproduce than an unrecorded sequence of arbitrary edits.

For visual work, assess readability, color fidelity, retained detail, and consistency across the collection. For machine-vision preprocessing, test whether the mapping improves the downstream task under representative lighting conditions. An attractive result is not automatically a better input for measurement, and aggressive contrast stretching can amplify noise along with genuine detail.

People also ask

Does setting the black point recover shadow detail?

No. It remaps existing values and can clip shadow distinctions if moved too far.

Can levels change color?

Yes. Adjusting channels separately changes their relationships and can alter color balance.

Should every image use pure black and pure white?

No. Some scenes and presentation styles appropriately occupy a narrower range.

Check your understanding

With input black 40 and white 140 mapped linearly to 0 and 200, what happens to input 90?

Answer: It maps to 100 because it is halfway between the input endpoints. Values below 40 would be clipped to the output black endpoint in this simplified mapping.

Related terms

  • Histogram
  • Contrast stretching
  • Clipping
  • gamma adjustment
  • curves adjustment
  • quantization
  • tonal range

Learn next

Practice mapping a short list of grayscale values before editing a photograph. Then compare input-endpoint changes, output-endpoint changes, and midtone changes while watching both the image and its histogram.

  • Histogram

More in Computer vision and multimodal AI

  • Learned perceptual image patch similarity (LPIPS) - Learned Perceptual Image Patch Similarity, usually abbreviated LPIPS, is a learned measure of visual difference between two images.
  • Lens-profile correction - Lens-profile correction uses a stored model of a lens and compatible capture conditions to compensate for predictable optical effects in an image.
  • Level set - A level set is the collection of points at which a function has the same specified value.
  • Light field - A light field describes light traveling through space as a function of position and direction.
  • Light transport - Light transport describes how light moves through a scene and interacts with surfaces and media before reaching a sensor or observer.
  • Line intersection - Line intersection is the geometric relationship in which two lines share one or more points.

Sources

Adobe, Adjust Tonal Range and Color Balance Using Levels: https://helpx.adobe.com/photoshop/desktop/adjust-color/color-corrections/adjust-levels-in-an-image.html

The official documentation was opened and its endpoint, midtone, and clipping descriptions checked. Numerical mappings and the local-history scenario are original teaching examples.

Previous: Level sum Next: Levenberg - Marquardt algorithm

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer