Here's a tricky one. I'm working with a physical map in which heights are represented with the usual color scale (i.e. the hue varies with the height of the landmarks, resulting in green plains and brownish mountains).
Now, I need to take this info to my 3d sofware as a heightmap to displace a plane and get a nice 3d terrain. The trick is that I need the heigh scale represented as luminance values, and I can't find a way to convert the image in photoshop.
I think the Gradient Map tool should be the way to go, yet this applies the gradient to luminance values; I would need it to map it to hue values instead...
I have achieved something quite close playing around with the Colorama filter in After Effects, yet I'd rather stick with Ps for this task.
Well, I found a not perfect but quite decent solution; I'll post it in case someone finds it useful.
I first changed my color space to Lab. Looking at the channels, the info in the Luminance channel can obviously be discarded, and the "b" channel is almost flat. So I copied the info in "a" channel to a new layer; get back to RGB and that's it.
This worked for me because my image grades only from green to red, not getting down to blues nor up to magentas, which would both make use of "b" channel in Lab. I'm loosing some info nontheless, but as my work is not for scientific purposes I can live with it.
Hope someone finds it useful, or better yet, that anyone can post a more precise method.
My God, this already looks like a blog rather than a thread!
Anyway, just for the info: Investigating further, I found the very interesting Adobe Pixel Bender tools, which probably would be the way to go for an extremely precise solution.
It would require some effort though.
I'd have to see your colors to see if they are arbitrary or if they lend themselves easily to some sort of conversion, but offhand I'd suggest the Black and White adjustment layer. Play with the sliders until the highest color is the brightest gray, and the lowest color is the darkest gray.
And try to work in 16-bits. Your height field will be happier later.