It seems OK, but I don't get the range parameter.
My pngs are 8 bit, so is scale a multiplication? Meaning scale 0,10 will get altitudes in 0 to 2560 meters range?
The range parameter is not taken into account while converting from PNG to ELEV (yet). It only defines the mapping of elevation point value to color value while converting from ELEV to PNG.
If you start with a PNG from scratch, the PNG does not contain the metadata that is needed for complete ELEV information (scale, min/max/mean, lon/lat, type, etc.). Therefore, ele2png produces default information:
- The minimal color value is mapped to -32768
- The maximal color value is mapped to +32767
- The value scale is 1.0
- The value offset is 0.0
- The elevation type is -16, i.e. 16-bit signed values are stored
- Padding is 1
- Min/max/mean values are calculated from actual values
- Lon/lat range values are calculated according to tile path, or set to zero if the path is not a valid texture tree path
- Colormap is dynamically guessed
The last point means, that with RGB PNGs for each color value the system first checks if it is a valid OT3 16-bit LUT color (the rainbow palette posted before), and if not, it calculates the distance to all LUT color and all grayscale values. The least distance value is then taken.
If it is grayscale already, it simply uses the grayscale value.
In other words: if you import from scratch, your color value is mapped to 16-bit signed, making black -32768m and white +32767m.
However, you can then make round-trips to change the scaling. Let's say your PNG black value is -10m and white is 100m. You first convert it to ELEV, getting black as -32km and white as +32km. This you convert to PNG again, with range parameter -r0 (for fixed maximum values), creating a RGB 8-Bit PNG with OT3 16-bit LUT colormap, where the deep blue value is -32km and the cyan value is +32km. This PNG will also contain the metadata in the PNG comment section. E.g. GIMP can edit this section, where you can change the first two parameters (vmin and vmax) to -10 and +100.
If such a PNG is then converted to ELEV again, the color deep blue (that was black in the original) is -10 and cyan (that was white in the original) is +100.
You could do the round-trip with -g option to get 16-bit grayscale, too, but then you'd have to use a picture manipulation tool that can use 16-bit color space (which e.g. GIMP can't do <V3).