An open API service indexing awesome lists of open source software.

https://github.com/dy/clip-pixels

Slice rectangle from pixels array
https://github.com/dy/clip-pixels

Last synced: 11 months ago
JSON representation

Slice rectangle from pixels array

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.org/dy/clip-pixels.svg?branch=master)](https://travis-ci.org/dy/clip-pixels)

Slice rectangle from an array with pixels.

### `clip(arr, shape=[w, h?, channels=4], rect=[x, y?, w?, h?])`

```js
var clip = require('clip-pixels')

var pixels = [
0, 1, 0,
1, 1, 1,
0, 1, 0
]
pixels = clip(pixels, [3, 3, 1], [1, 0, 2, 3])

/*
1, 0,
1, 1,
1, 0
*/
```

See also [flip-pixels](https://ghub.io/flip-pixels).