Converts Mapbox's Terrain-RGB PNG tiles to 16 bit greyscale PNGs depicting integer slope percentage. See here for an online demo.
npm install terrain-rgb-slope
var converter = require('terrain-rgb-slope');
var options = {
inputFilePath: '/path/to/my/terrain-rgb-tile.png',
outputFilePath: '/path/to/output/16bit-slope.png'
};
converter.convertToSlope(options, function() {
console.log("Finished.");
});