I am using qgis to create a raster elevation image (png) from SRTM data. I need to create a png via qgis which I will then query to determine the rgb of particular pixels via php. How do I define a color scheme within qgis in a way that I can then use the same gradient to calculate the elevation of the pixel from the png?
To be honest that is not a good way to do it.
But if you must then you could encode the value of the dem in the R (or G or B) element of the image by calculating
256*(value/maxValue). Your Php code could then reverse the calculation as