Height map color to grayscale

You all have similar problem to mine.milanowek_1x1
No idea how to transform into Grayscale :frowning:
original colour scale I guess is that: heightmap legend and wanted scale looks like this: greyscale
but not this: converted

Hello here a solution.
The trick is to transform the color to coordinate. 0 to 255 becomes automatically -1 to 1 in Grasshopper.
So I draw a line on each Gradient, divide each line in N points.
This look like to this.


Then I deconstruct your image. Find the closest color in first gradient. The closest points gives also an index that I use to get the color in second gradient.

“Et voilà”.
The only problem is that the automatic color to point gives [-1 to 1] and the Color from RGB uses [0 to 1] value. It is not very consistant.

Image gradient to gradient.gh (23.6 KB)

Your initial image colors

2 Likes

Strictly related: