Turn all blue areas to white

Hello,

I am afraid this is an extremely stupid question but I haven’t been able to find the answer yet…

I would like to turn all the blue areas of an image to white.
I can easily select these areas using the color treshold tool, the I guess from this I could create a new image with my white shape, and stack with the initial image… but how can I concretely do that ?

Have a look at the changeValues macro function:

https://imagej.nih.gov/ij/developer/macro/functions.html#C

Example (blue to red):

newImage("Untitled", "RGB white", 500, 500, 1);
setForegroundColor(0, 0, 255);
makeOval(129, 168, 92, 71);
run("Fill", "slice");
makeOval(332, 205, 67, 70);
run("Fill", "slice");
makeOval(263, 37, 108, 75);
run("Fill", "slice");
run("Select None");
changeValues(0x0000ff,0x0000ff,0xff0000)
3 Likes

I think @Bio7 has the best answer if you want a macro, and can define in advance the values you want to change.

For a more interactive alternative, inside the color threshold tool you can press the ‘Select’ button. Then just press the ‘f’ key (the shortcut for Edit → Fill) to fill the area with the current fill color.

You can set the fill color under Image → Color → Color Picker… - or by clicking the eye dropper icon in the ImageJ toolbar.

1 Like