# ndarray-from-image

> Extracts an image RGBA pixels as a ndarray

Latest version **1.0.1** (published 2015-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install ndarray-from-image
pnpm add ndarray-from-image
yarn add ndarray-from-image
bun add ndarray-from-image
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-09-27 |
| First published | 2015-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | thibauts |
| Maintainers | thibauts |
| Keywords | ndarray, image, pixels |

## Links

- npm: https://www.npmjs.com/package/ndarray-from-image
- Repository: https://github.com/thibauts/ndarray-from-image
- Issues: https://github.com/thibauts/ndarray-from-image/issues
- npm.io page: https://npm.io/package/ndarray-from-image

## Dependencies (3)

- [dtype](https://npm.io/package/dtype.md) ^2.0.0
- [ndarray](https://npm.io/package/ndarray.md) ^1.0.18
- [get-image-pixels](https://npm.io/package/get-image-pixels.md) ^1.0.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-09-27
- 1.0.0 — 2015-09-27

## README

ndarray-from-image
==================
### Extracts an image RGBA pixels as a ndarray

Extracts an image RGBA pixels as a ndarray with shape `[width, height, 4]`. If a [dtype](https://github.com/shama/dtype) is provided as a second parameter, allocates a new typed array of the given type for use as the ndarray underlying data.

Install
-------

```bash
$ npm install ndarray-from-image
```

Usage
-----

```javascript
var ndarrayFromImage = require('ndarray-from-image');

var img = document.getElementById('img');
var arr = ndarrayFromImage(img/*, 'float32' */); // takes an optional dtype as a second parameter

/*
  arr now contains the canvas RGBA pixels as a ndarray 
  of shape [canvas.width, canvas.height, 4]
*/

var value = arr.get(0, 0, 0); // will return the red value for the pixel of coordinates [0, 0].
```

---
_Source: https://npm.io/package/ndarray-from-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
