colkassad / terrain-rgb-height

Converts Mapbox's Terrain-RGB PNG tiles to 16 bit greyscale PNGs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Converts Mapbox's Terrain-RGB PNG tiles to 16 bit greyscale PNGs

License:MIT License


Languages

Language:JavaScript 100.0%