How can I see in red the pixels over a certain value and blue under another value

I am not sure if this can be done with the threshold tool or by creating a LUT or in another way.
In a greyscale image I want to mark with red the pixels over a “high threshold” and blue the pixels under a “low threshold”. In between, we can keep the original image or it can be seen as white.

If possible, something that can be implemented in a macro.
Thank you!!

Another option is to use the HiLo LUT (Image > Lookup Tables > HiLo; available in #fiji, see also the Visualization page on the wiki).

(This solution differs from the one suggested by @anon96376101 mainly in that it changes the display of the intensities between the low and high “thresholds” to be in the full range between black and white.)

  • Open any 8-bit grayscale image (e.g. the Gel sample image).

  • Switch to the HiLo lookup table (Image > Lookup Tables > HiLo).

  • Adjust the Minimum and Maximum to your desired values in the B&C window (Image > Adjust > Brightness /Contrast… or Shift+C); you can also use the Set button to enter the values in a dialog in a recordable way.

  • If you want to use this image outside ImageJ (e.g. in a presentation or figure), convert it to RGB (Image > Type > RGB Color).

I leave it as an exercise to you to record this as a macro using the recorder.


Thank you very much Herbie and imagejan, I appreciate your help.

The HiLo method works well, and Herbie’s macro works well in imageJ 1.52a, but for some reason does not work properly in Fiji: it only keeps the upper (red) threshold, not the blue one, and I get an Exception window. I will try to run it step by step to find out the reason.


My macro was tested under the curent daily build of ImageJ which is version 1.52k71. Please up-date your Fiji to the same version.

I just tried version 1.52j and it gives me a

at ij.plugin.frame.RoiManager.moveRoisToOverlay(

but provides the desired result.

Consequently, please work with the daily build.