Contrast stretching

Tags: #<Tag:0x00007fb87c05e330> #<Tag:0x00007fb87c05e150>


This post was flagged by the community and is temporarily hidden.


Hi @Axel92Dev, and welcome to the forum!

Enhance Contrast will change the pixel values, as this macro should show:

run("Blobs (25K)");
run("Duplicate...", "title=blobs-enhanced.gif");
run("Enhance Contrast...", "saturated=10 normalize");

If the image looks different but the histogram doesn’t change, then I’m not sure what’s going on.

To figure it out, it would be helpful to see a sample image and the exact steps you did, and the histograms before and after. It is convenient to use the macro recorder (Plugins > Macros > Record…) to keep track of your steps.

Hope this helps.


Dear @Axel92Dev,

welcome to the forum! :slight_smile:

The Enhance Contrast command does not actually alter pixel intensities but changes the so-called look-up table (LUT). That is, the mapping between intensity values and color. To propagate the changes to the pixel intensities, you have to run Image > Lookup Tables > Apply LUT.



Trying to resolve this difference in behavior, I discovered Enhance Contrast has different behaviors according to the options that are selected. In the user guide:

This command does not alter pixel values as long as Normalize, Equalize Histogram or Normalize All n Slices (in the case of stacks) are not checked.

So Enhance Contrast does the following:

  • No boxes checked: only the display is enhanced. Image > Lookup Tables > Apply LUT to change pixel values.
  • Normalize or Equalize checked: pixel values will be altered.


Thank you guys, you helped a lot!