0.0.3 • Published 4 years ago

terrain-rgb-height v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

terrain-rgb-height

Converts Mapbox's Terrain-RGB PNG tiles to 16 bit greyscale PNG heightmaps. See here for an online demo and here for an example use case of importing 16 bit PNGs into Unreal Engine 4.

Installation

npm install terrain-rgb-height

Examples

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.");
});