Quote Originally Posted by waldronate View Post
I would think that it depends on the precise image format and what you want in your lookup table. Most image editing tools have an option to save a palette and load a new palette, but they have a tendency to want to convert palettes to preserve colors in the image (that is, they tend to convert to RGB from the original palette and then back to indexed color on the new palette).

If you want to do something like convert an 8-bit PNG with arbitrary colors into an 8-bit PNG with grayscale colors that represent height, then you'd replace the PLTE chunk with a different one. For best results (and to avoid having to recode everything), you'd want to write the PLTE chunk to a file that's easy to edit (like text), edit the PLTE, then read the new one back from the file.

https://onlinepngtools.com/change-png-color looks like it might allow interactive adjustments of an 8-bit PNG.

If your image is something other than an 8-bit PNG, complexity will increase. I did a generalized "color to altitude" thing for Fractal Terrains some years back that will convert colors in an image to altitudes in its internal map, but (a) it's Fractal Terrains and (b) it doesn't do a particularly good job at color edges or dithering.
Thankyou ! Basically I wanted to create a loookup table to load in Wilbur .