Split colored height map of moon in greyscale images


I’m new to imageJ, I used it in the past to convert some binary data to images.

Now i want to do something completly different. I found this nice picture of the moon on the NASA website.

and i want to do some art from it. For this i like to split the heightmap in let’s say four images, each represening a certain range (i.e. -9150 to -2000, -2000…0,0…2500…).
The LUT is embedded into the image and i want to use this LUT somehow to get several greyscale heigth maps for further processing.

Thanks in advance

Hi @Knochi

First thing which comes to my mind is color-thresholding each height and then combine the different labels. I doubt that it is possible to just apply five thresholds, because of the smooth transitions.


exactly. but how can i do this in imageJ?

Image -> Adjust -> Color Threshold…

Hi All,

I had a bit of fun with this one.

A few points though.

  1. It seems that this image also has some shadows applied to it, to make the topography stand out some more.
  2. There also seems to be some aliasing, the raw data most likely being rather larger than the image presented here
  3. It is a JPEG, so the pixel information is a bit lossy.

Still, what I did was take the line profile of the color scale bar and stored the values into an array.
I then calculated the euclidean distance of the RGB value of each pixel to the RGB values of the scale bar array and kept the index of the shortest distance.

However because of the shadows, there were a few pixels here and there with values that matched the background rather than the scalebar. For these I then ran a median filter to clean up what I could.

I am uploading the 16-bit tif so there might be no preview.

Original 16-bit tif: here

Here is also an example of the image using a Union Jack Lookup table, as suggested by @romainGuiet

If you want the macro code, it is available as a public GIST on GitHub https://gist.github.com/lacan/db89358ca5ba5d4308a52fc37cd05550

Happy Imaging!


Awesome! Thanks a lot!
I will post pictures of the final art object if I’m done.

Hi i discovered this post and have the same problem as autor but different image, i didnt know is program like this ImageJ, i spend 4 hours figure out how convert my image this script you send but fail. I know i asking too much but can you send me some tutorial how use ImageJ with your script to convert my image?