Convert an image to an ndarray json file


A CLI tool for converting images (PNG) to ndarray json files.

Basically it is Mikola Lysenko's script copied and turned into a binary to run anywhere.

You have an image ./terrain.png. Convert it with ndconvert terrain.png > terrain.json. Then in your module use it with:

var decodeBase64 = require('base64-js').toByteArray
var ndarray = require('ndarray')
var terrain = require('./terrain.json')
var texture = ndarray(
  new Uint8Array(decodeBase64(terrain.data)),

With npm do:

npm install ndconvert -g
  • 0.1.0 - initial release