# canvascondense

> Compress image with canvas for upload

Latest version **1.0.5** (published 2018-08-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install canvascondense
pnpm add canvascondense
yarn add canvascondense
bun add canvascondense
```

## 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.0.5 |
| Published | 2018-08-12 |
| First published | 2018-08-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 27.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | zhengfa |
| Maintainers | zhengfa |
| Keywords | canvas, compress |

## Links

- npm: https://www.npmjs.com/package/canvascondense
- Repository: https://github.com/zhengfa/canvascompress
- Homepage: https://github.com/zhengfa/canvascompress#readme
- Issues: https://github.com/zhengfa/canvascompress/issues
- npm.io page: https://npm.io/package/canvascondense

## Dependencies (2)

- [browserify](https://npm.io/package/browserify.md) ^16.2.2
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.24.1

## 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.0.5 (latest) — 2018-08-12
- 1.0.4 — 2018-08-11
- 1.0.3 — 2018-08-11
- 1.0.2 — 2018-08-11
- 1.0.1 — 2018-08-11
- 1.0.0 — 2018-08-11

## README

# canvascondense
Compress image to DataUrl with canvas for upload

Installation
------------
TypeScript
```
# Install NPM module.
npm install --save canvascondense
```
Usage
------------
# Demo in VUE
------------
```
<template>
    <div>
        <input type="file" name="picture" onchange="compress(event)"/>
    </div>
</template>
<script>
    import cvscds from 'canvascondense';
    export default{
        methods:{
            compress(){
                new cvscds(event.target, {
                    maxpix: 1000,
                    qulity: 0.8
                }).compress().then((DataUrl) => {
                    //You can post the DataUrl data to server api and save as image right here
                }).catch((err) => {
                    //err
                });
            }
        }
    }
</script>
```
------------
#Demo in Browser
------------
```
#Html
<input type="file" name="picture" onchange="compress(event)"/>

#Javascript
<script src="./js/canvascondense.min.js"></script>
<script type="text/javascript">
    var changecallback = function (event) {
        new canvascondense(event.target, {
            maxpix: 1000,
            qulity: 0.8
        }).compress().then((DataUrl) => {
            //You can post the DataUrl data to server api and save as image right here
        }).catch((err) => {
            //err
        });
    }
</script>
```

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