Converts Mapbox's Terrain-RGB PNG tiles to 16 bit greyscale PNG heightmaps. See my demo map repository for an example implementation.
npm install terrain-rgb-height
var converter = require('terrain-rgb-height');
var options = {
inputFilePath: '/path/to/my/terrain-rgb-tile.png',
outputFilePath: '/path/to/output/16bit.png'
};
converter.convert(options, function() {
console.log("Finished.");
});
There is an option to scale the 16 bit pixels from 0 to 65535:
var converter = require('terrain-rgb-height');
var options = {
inputFilePath: '/path/to/my/terrain-rgb-tile.png',
outputFilePath: '/path/to/output/16bit.png',
scaleValues: true
};
converter.convert(options, function() {
console.log("Finished.");
});