A have a GeoTIFF LIDAR image which display DEM in its color-ramp version (color relief) from blue (minimum value) to red (maximum value) and green (in between).

I don't have the original elevation data.

Is there any application or algorithm to turn this 'color coded' maps into its original DEM? (elevation data).

Suppose from another measurement, I know the elevation at multiple point in the DEM to reference the color-map. (or in case I'm sure that some region is the sea, I'll assign zero to it).

  • 3
    No, there is no way to do this, contact the agency you got this data from and ask nicely for the DEM data. This is because even if you know the minimum and maximum you don't know every subtle variation of RGB and multiple elevations can have the same RGB value. Commented Apr 28, 2016 at 4:08
  • Why doesn't the color represent elevation data? What are colors representing in the DEM? How were they assigned to it? Commented Apr 28, 2016 at 11:34

1 Answer 1


I believe it is possible, but probably not very accurate. Multiple elevations do not have same RGB value if the ramp is continuous and not like having red at both extremes.

I would probably start by reducing the number of colors and saving the result into a paletted image by using rgb2pct-py. Then, I would vectorize the paletted version with gdal_polygonize. Last step would be to attach height values into the polygons and that would require some manual work with for example QGIS. The polygons will have at this stage the source color as an attribute which saves works because all polygons with the same palette entry can be joined to corresponding height range by the same.

The result depends on how well the color ramp that is used in your maps suits for polygonization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.