# @fast-pixel/clip

> Clip Pixels

Latest version **0.0.1** (published 2020-12-27) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install @fast-pixel/clip
pnpm add @fast-pixel/clip
yarn add @fast-pixel/clip
bun add @fast-pixel/clip
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-12-27 |
| First published | 2020-12-20 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniel J. Dufour |
| Maintainers | danieljdufour |
| Keywords | clip, fast, pixel |

## Links

- npm: https://www.npmjs.com/package/@fast-pixel/clip
- Repository: https://github.com/DanielJDufour/fast-pixel
- Homepage: https://github.com/DanielJDufour/fast-pixel#readme
- Issues: https://github.com/DanielJDufour/fast-pixel/issues
- npm.io page: https://npm.io/package/@fast-pixel/clip

## Dependencies (1)

- [get-depth](https://npm.io/package/get-depth.md) 0.0.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2020-12-27
- 0.0.0 — 2020-12-20

## README

@fast-pixel/clip
> Clip Pixels

# install
```bash
npm install @fast-pixel/clip
```

# usage
## clipping png file
If we wanted to remove two pixels from the edge of the image.
```javascript
const fs = require("fs");
const readPNG = require("read-png");
const clip = require("@fast-pixel/clip");

const png = await readPNG({ data: fs.readFileSync("./flower.png") });

const clipping = clip({
  data: png.pixels, // numerical array of pixel values

  /*
    dimensions of the output / clipping 
    1: all the pixels are interleaved like r0,g0,b0,a0,r1,g1,b1,a1,...
    2: an array of band values where [ [r0, r1, r2, ...], [g0, g1, g2, ...] ]
    3: by band then row the column [ [ b0r0c0, b0r0c1 ] ... ]
  */
  ndim: 3, 

  top: 2, // how far from the top to start clipping
  bottom: png.height - 2, // how far from the top to stop clipping

  left: 2, // how far from the left to start clipping
  right: png.width - 2 // how far from the left to start clipping

  height: png.height // height of the input image
  width: png.width // width of the input image
})
```

---
_Source: https://npm.io/package/@fast-pixel/clip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
