Convert an Uint8ClampedArray to an image.
$ npm install --save array-to-image
import { getImgFromArr } from 'array-to-image';
const data = new Uint8ClampedArray(256 * 256 * 4);
for(let i = 0; i < data.length; i += 4) {
data[i] = 255; // r
data[i + 1] = 0; // g
data[i + 2] = 0; // b
data[i + 3] = 255; // a
}
const img = getImgFromArr(data);
Get a data url string from the given Uint8ClampedArray arr
.
If w
and h
are ommitted, the image is considered to be squared.
Get an image
from the given url string data
.
Get an image
from the given Uint8ClampedArray arr
.
If w
and h
are ommitted, the image is considered to be squared.
MIT, see LICENSE.md for more details.