1 | get-pixels
|
2 | ==========
|
3 | Given a URL/path, grab all the pixels in an image and return the result as an [ndarray](https://github.com/mikolalysenko/ndarray). Works both in browserify and in node.js.
|
4 |
|
5 | **Note** On the node side, currently only supports PNG and PPM. Patches welcome!!!
|
6 |
|
7 | Example
|
8 | =======
|
9 |
|
10 | ```javascript
|
11 | var getPixels = require("get-pixels")
|
12 |
|
13 | getPixels("lena.png", function(err, pixels) {
|
14 | if(err) {
|
15 | console.log("Bad image path")
|
16 | return
|
17 | }
|
18 | console.log("got pixels", pixels.shape)
|
19 | })
|
20 | ```
|
21 |
|
22 | Install
|
23 | =======
|
24 |
|
25 | npm install get-pixels
|
26 |
|
27 | ### `require("get-pixels")(url, cb(err, pixels))`
|
28 | Reads all the pixels from url into an ndarray.
|
29 |
|
30 | * `url` is the path to the file
|
31 | * `cb(err, pixels)` is a callback which gets triggered once the image is loaded.
|
32 |
|
33 | **Returns** An ndarray of pixels in raster order having shape equal to `[rows, columns, channels]`.
|
34 |
|
35 | Credits
|
36 | =======
|
37 | (c) 2013 Mikola Lysenko. MIT License |
\ | No newline at end of file |