Packs integer values from a 2D ndarray into an RGB one for storing as compressed images
npm install rgb-pack
|1||downloads in the last month|
|Version||0.0.0 last updated 5 months ago|
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.
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
Unpacks a previously packed
image ndarray into a 2D
If you don't supply a
map, one will be created for you.
MIT. See LICENSE.md for details.