canvas-pixels
Version:
Grab the pixels from a canvas' context, be it 2D or 3D, and return them in an array.
23 lines (13 loc) • 704 B
Markdown
# canvas-pixels [](http://github.com/badges/stability-badges)
Grab the pixels from a canvas' context, be it 2D or 3D, and return them in
an array.
## Usage
[](https://nodei.co/npm/canvas-pixels/)
### pixels = getPixels(context)
Returns `context`'s pixels in an array – with a 2D context, this will be a
`Uint8ClampedArray`, and a webgl context will return a `Uint8Array`.
### pixels.get2d(context)
### pixels.get3d(context)
Same as above, but without the auto-detection.
## License
MIT. See [LICENSE.md](http://github.com/hughsk/canvas-pixels/blob/master/LICENSE.md) for details.