Hello ImageJ people,
I have a macro file with which I want to invert parts of the image. This works fine so far. The problem however kicks in, when it's an "8-bit color" image. Inversion does not work with them, which makes sense, since there is a limitation of max. 256 distinct color tones. My roundabout would be to convert the image type to "RGB color" first, and only then invert. Now, how do I distinguish both types: "8-bit" and "8-bit color" in a macro? With the command bitDepth(); I can only tell the bit depth but not whether its mode is grayscale or color. Also, my worst-case idea of splitting the colors by run("Split Channels"), then check the contents of the R,G, and B image and re-merge them into an RGB color image if they differ does not work. As far as I understood now, "8-bit color" images use a special Lookup table in which the values 0-255 are assigned an RGB display color. My next idea would be to go through the LUT with getLut(reds, greens, blues) - but this seems to be a very brute force solution. Any easier suggestions?
Thanks Martin