You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
404 B
23 lines
404 B
4 years ago
|
[![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
|
||
|
*/
|
||
|
```
|