This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
ndconvert with all
npm packages installed. Try it out:
ndconvert lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
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)), terrain.shape, terrain.stride, terrain.offset )
With npm do:
npm install ndconvert -g