# trim-canvas

> A tiny library for trimming whitespace from a canvas element

Latest version **0.1.2** (published 2017-05-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install trim-canvas
pnpm add trim-canvas
yarn add trim-canvas
bun add trim-canvas
```

## 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.1.2 |
| Published | 2017-05-25 |
| First published | 2016-09-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 74 |
| Author | Anton Gilgur |
| Maintainers | agilgur5 |
| Keywords | canvas, trim, whitespace, remove, blanks, removeBlanks, remove-blanks |

## Links

- npm: https://www.npmjs.com/package/trim-canvas
- Repository: https://github.com/agilgur5/trim-canvas
- Homepage: https://github.com/agilgur5/trim-canvas#readme
- Issues: https://github.com/agilgur5/trim-canvas/issues
- npm.io page: https://npm.io/package/trim-canvas

## 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

- 0.1.2 (latest) — 2017-05-25
- 0.1.1 — 2016-09-01
- 0.1.0 — 2016-09-01

## README

# trim-canvas

[![NPM](https://nodei.co/npm/trim-canvas.png?downloads=true&downloadRank=true&stars=true)](https://npmjs.org/package/trim-canvas)

A tiny (< 100 LoC) library for trimming whitespace from a `canvas` element with
no dependencies.

## Installation

`npm i -S trim-canvas`

## Usage

```
import trimCanvas from 'trim-canvas'

let canvas = document.createElement('canvas')

// do some drawing on it ...

trimCanvas(canvas)
// now the whitespace has been trimmed
```

If you don't want to mess with your existing canvas, then simply clone the
canvas element beforehand.

`trim-canvas` returns the canvas element for easy chaining.

## Credits

Credits go to [@efc](https://github.com/efc) for writing a quick version of this
in [this issue](https://github.com/szimek/signature_pad/issues/49#issue-29108215)
and to the original [StackOverflow Answer](http://stackoverflow.com/a/12178531/3431180)
that was credited in that issue.

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