rgb-pack

0.0.0 • Public • Published

rgb-pack experimental

Packs integer values from a 2D ndarray into an RGB one for storing as compressed images.

Works particularly well for storing heightmaps with more precision than a single channel can offer - instead of a dynamic range of 256 values, you get 16,777,216. You could combine this pretty easily with save-pixels and get-pixels for good results.

Usage

rgb-pack

require('rgb-pack').pack(map[, image])

Packs a 2D ndarray map into a 3D image ndarray. You could then use save-pixels to store this result as a PNG image.

If you don't supply an image, one will be created for you.

Note that the data in map are expected to be integer values between 0 and 16,777,216.

require('rgb-pack').unpack(image[, map])

Unpacks a previously packed image ndarray into a 2D map.

If you don't supply a map, one will be created for you.

License

MIT. See LICENSE.md for details.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.0
    0

Package Sidebar

Install

npm i rgb-pack

Weekly Downloads

0

Version

0.0.0

License

MIT

Last publish

Collaborators

  • hughsk