Hi all, I am writing a plug-in for imageJ on java.
I have an image to edit, and the image is an 8-bit grayscale image.
I need to make the white pixels (255) in the image to red pixels.
Meaning, I have to convert the picture to a 24-bit RGB.
I'm having some problem doing that.
Can someone help me?
ImageProcessor c = copy.convertToRGB();
Color color = new Color(255, 0, 0);
for (int v = 0; v < h; v++) {
for (int u = 0; u < w; u++) {
int x = c.get(u, v);
if (x == 255) {
c.setColor(color);
}
else {
image.set(u, v, 0);
}
}
}
Even doing all these, my image still remains the same and there are no changes. May I know why? The code for red colour is (255, 0, 0), but it just doesn't work. Am I missing out something?