# image-ghost-canvas

> image resize, canvas resize

Latest version **1.1.0** (published 2018-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install image-ghost-canvas
pnpm add image-ghost-canvas
yarn add image-ghost-canvas
bun add image-ghost-canvas
```

## 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.1.0 |
| Published | 2018-07-09 |
| First published | 2018-06-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 92.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | misupopo |
| Maintainers | misupopo |
| Keywords | image, resize, trimming, keeping aspect ratio, aspect ratio |

## Links

- npm: https://www.npmjs.com/package/image-ghost-canvas
- Repository: https://github.com/misupopo/image-ghost-canvas
- Homepage: https://github.com/misupopo/image-ghost-canvas#readme
- Issues: https://github.com/misupopo/image-ghost-canvas/issues
- npm.io page: https://npm.io/package/image-ghost-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

- 1.1.0 (latest) — 2018-07-09
- 1.0.8 — 2018-07-03
- 1.0.6 — 2018-07-03
- 1.0.3 — 2018-06-29
- 1.0.2 — 2018-06-29
- 1.0.1 — 2018-06-29
- 1.0.0 — 2018-06-29

## README

# image-ghost-canvas
image-ghost-canvas is a tool for image you want to trimming cut on Browser.
for example if you want to cut with keeping the image's aspect ratio, I recommend this tool for that.

### Demo
<a target="_blank" href="https://plnkr.co/edit/kyFSt7SrA1lgZE381vYw?p=preview">Plunker</a>

### Usage
```js
import ImageGhostCanvas from 'image-ghost-canvas';
public imageGhostCanvas = new ImageGhostCanvas(option);
```
`option` \<Object>
* size \<Number> Size for trimming image size.

#### Resize image
```js
imageGhostCanvas.resizeImage(data);
```
`data` \<[data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs)> you can git encoded image data that its type jpeg or ping. 

`Return:` \<Promise>

### Example
```js
// success
imageGhostCanvas.resizeImage(imageData)
.then((data) => {
    imageSrc = data;
});

// error
imageGhostCanvas.resizeImage(imageData)
.catch((error) => {
    // when it result error, do something for error.
}); 

```

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