Set intensity range🔗

Scales or clamps the gray levels or color channels of an image into a given range.


  • image: Input image.

  • mode: Mode of operation.

  • min: minimum gray level.

  • max: maximum gray level.


  • image: a grayscale image with the smallest possible number of bits per pixel.

enum Mode🔗

Supported operation modes.


enumerator Cap🔗

Cap the existing range to the new range.

Everything below min will be set to min and everything above max will be set to max.

enumerator Stretch🔗

Stretch the existing range to the new range.

The minimum intensity level of the input will be moved to min and the maximum to max. The rest will be uniformly scaled in between.

enumerator CapAndStretch🔗

First Cap the existing range to the new range, then stretch the range to [channel_min, channel_max].

enumerator Scale🔗

Scale the range from [channel_min, channel_max] to the new range.

For example, you can scale any (e.g 10-bit or binary) image to an 8-bit image by setting min = 0 and max = 255.