Given a path, grab all the pixels in an image and return the result as an ndarray.
Currently the following file formats are supported:
PNG
JPEG
GIF
import { handler } from 'get-pixels-ts';
const pixels = await handler("lena.png");
console.log("got pixels", pixels.shape.slice());
npm install get-pixels-ts
Reads all the pixels from path into an ndarray.
path
is the path to the file.
Returns An ndarray of pixels in raster order having shape equal to [width, height, channels]
.
Note For animated GIFs, a 4D array is returned with shape [numFrames, width, height, 4]
, where each frame is a slice of the final array.
(c) 2013-2014 Mikola Lysenko. MIT License