Newbie question, so I apologize in advance if this is already well known. I have a topographic surface as an RGB image in which elevation has been defined by a “rainbow” color scale that I wish to convert to XYZ values. The method in ImageJ is obvious enough when the color image converts using a standard method to a grayscale with linear monotonic increase with elevation. In my current case, however, the color scale defining topography changes from dark red to lighter yellow to darker green to lighter blue to dark blue, which makes the standard grayscale image rather unusable. In photoshop I have masked the different colors and changed each color to a specified greyscale range before recombining the layers (and I am sure this would be easy to do in ImageJ also), but, my question, is there a way to automate this for a general case with ImageJ? That is, to use (calibrate) the color scale bar to define a grayscale image without first hand editing the color ranges.