Reads the pixels of an image as an ndarray
Currently the following file formats are supported:
var getPixels = require"get-pixels"getPixels"lena.png"iferrconsole.log"Bad image path"returnconsole.log"got pixels" pixelsshapeslice
npm install get-pixels
Reads all the pixels from url into an ndarray.
urlis the path to the file. It can be a relative path, an http url, a data url, or an in-memory Buffer.
typeis an optional mime type for the image (required when using a Buffer)
cb(err, pixels)is a callback which gets triggered once the image is loaded.
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