← Image Processing for EveryoneToolsInVisionLearning Center
Enhancement and Filtering · Lesson 5

Brightness, Contrast, and Clipping

A faint scratch can become easier to see, but clipping can erase highlight detail.

Watch the lesson

Brightness, Contrast, and Clipping explained visually

2:07

A faint scratch can become easier to see, but clipping can erase highlight detail. English captions are optional and start off. The complete transcript follows the written lesson.

Lesson overview

What you will learn

A faint scratch can become easier to see, but clipping can erase highlight detail.

  1. Inspect before adjusting
  2. Shift or spread values
  3. Protect information
  4. A worked example
01

Inspect before adjusting

Our inspection camera has captured a silver part with a faint scratch. On one screen the image is dark; on another it looks washed out. Before dragging a slider, ask what needs fixing. Brightness moves intensity values up or down. Contrast changes the differences between them. A histogram can show how many pixels have each intensity, but it cannot show where the scratch sits in the image.

02

Shift or spread values

The simplest brightness change adds the same number to every value. A simple contrast change stretches or compresses differences around a chosen reference. Both can push an eight-bit value outside its zero-to-two-hundred-and-fifty-five range. The saved result is clipped at the boundary. If two different highlights both become two hundred and fifty-five, the processed copy has lost their difference. Turning brightness down afterward cannot tell us which highlight was originally brighter.

03

Protect information

Gamma adjustments work differently: they change dark and bright regions by different amounts. They can make a display easier to inspect, but the formula and color encoding matter. Compare the original and adjusted image at the same display scale. If the picture is scientific measurement data or model training input, keep that role separate from a display-only improvement. A dramatic-looking scratch is not automatically a more accurate measurement.

04

A worked example

Try three values: twenty, one hundred and twenty, and two hundred and forty. Add thirty. Before clipping, they become fifty, one hundred and fifty, and two hundred and seventy. In eight bits, we store fifty, one hundred and fifty, and two hundred and fifty-five. The last value cannot tell us that it used to be two hundred and forty. Preserve the original; next, we'll explore ways to improve contrast while watching for noise.

Worked example

Take three eight-bit intensity values: 20, 120, and 240. Adding 30 gives 50, 150, and 270 before clipping. The stored result becomes 50, 150, and 255. The last value lost information because 270 cannot fit in the allowed range.

Knowledge check

Quick check: test your understanding

Try it yourself: What happens if you subtract 30 from the clipped result? Does it recover the original final value?

Check the reasoning

The last value becomes 225, not 240. Clipping made the operation irreversible for that pixel.

Can two very different images have the same histogram?

Yes. A histogram counts values but ignores their spatial arrangement.

How would you solve the practice case?

The last value becomes 225, not 240. Clipping made the operation irreversible for that pixel.

What does the worked example show?

Take three eight-bit intensity values: 20, 120, and 240. Adding 30 gives 50, 150, and 270 before clipping. The stored result becomes 50, 150, and 255. The last value lost information because 270 cannot fit in the allowed range.

Further reading

Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.

Original ToolsInVision teaching examples. Editorial approach · Suggest a correction

Accessible referenceLesson 5 transcript278 words · Video transcript · Matches the published narration and captionsOpen transcript

Our inspection camera has captured a silver part with a faint scratch. On one screen the image is dark; on another it looks washed out. Before dragging a slider, ask what needs fixing. Brightness moves intensity values up or down. Contrast changes the differences between them. A histogram can show how many pixels have each intensity, but it cannot show where the scratch sits in the image.

The simplest brightness change adds the same number to every value. A simple contrast change stretches or compresses differences around a chosen reference. Both can push an eight-bit value outside its zero-to-two-hundred-and-fifty-five range. The saved result is clipped at the boundary. If two different highlights both become two hundred and fifty-five, the processed copy has lost their difference. Turning brightness down afterward cannot tell us which highlight was originally brighter.

Gamma adjustments work differently: they change dark and bright regions by different amounts. They can make a display easier to inspect, but the formula and color encoding matter. Compare the original and adjusted image at the same display scale. If the picture is scientific measurement data or model training input, keep that role separate from a display-only improvement. A dramatic-looking scratch is not automatically a more accurate measurement.

Try three values: twenty, one hundred and twenty, and two hundred and forty. Add thirty. Before clipping, they become fifty, one hundred and fifty, and two hundred and seventy. In eight bits, we store fifty, one hundred and fifty, and two hundred and fifty-five. The last value cannot tell us that it used to be two hundred and forty. Preserve the original; next, we'll explore ways to improve contrast while watching for noise.