array-to-image
Convert an Uint8ClampedArray to an image.
Installation
$ npm install --save array-to-image
Usage
; const data = 256 * 256 * 4; forlet i = 0; i < datalength; i += 4 datai = 255; // r datai + 1 = 0; // g datai + 2 = 0; // b datai + 3 = 255; // a const img = ;
API
dataUrl = getDataUrlFromArr(arr, w, h)
Get a data url string from the given Uint8ClampedArray arr
.
If w
and h
are ommitted, the image is considered to be squared.
img = getImgFromDataUrl(data)
Get an image
from the given url string data
.
img = getImgFromArr(arr, w, h)
Get an image
from the given Uint8ClampedArray arr
.
If w
and h
are ommitted, the image is considered to be squared.
License
MIT, see LICENSE.md for more details.