# vue-como-image

> 前端图像处理库

Latest version **1.0.5** (published 2021-01-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-como-image
pnpm add vue-como-image
yarn add vue-como-image
bun add vue-como-image
```

## 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 | 2021-01-23 |
| First published | 2020-10-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | szjcomo |
| Maintainers | como20170606 |
| Keywords | image, como, szjcomo, vue-image, vue-como-image |

## Links

- npm: https://www.npmjs.com/package/vue-como-image
- Repository: http://git.sizhijie.com/vue-plugins/vue-como-image
- npm.io page: https://npm.io/package/vue-como-image

## 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) — 2021-01-23
- 1.0.4 — 2021-01-23
- 1.0.3 — 2021-01-23
- 1.0.2 — 2020-11-28
- 1.0.1 — 2020-11-04
- 1.0.0 — 2020-10-09

## README

# vue-como-image

- 基于canvas的图片处理库,零依赖,可用于图片灰度化、二值化、图片信息矩阵转换、图片压缩、图片base64
- 特别提示：图片二值化分两种算法，默认是抗颜色的变化，可手动指定二值化参数 
- `await comoImage.image2Binary(base64_content,'cus',127,5)`


## 安装
```
npm install vue-como-image

```

## 使用

```js
import comoImage 	from 'vue-como-image';

//图片压缩
await comoImage.compress(file,options = {}) return {content:base64_content,file:File}

//文件转base64
await comoImage.file2Base64(file) return base64_content;

//base64转文件
await comoImage.base642File(base64_content) return File

//图片灰度化 默认平均值
await comoImage.image2Gray(base64_content,avg = 0) return base64_content

//图片二值化
await comoImage.image2Binary(base64_content,type = 'auto',ave = 0,ratio = 5) return base64_content

//获取图片pixel信息
await comoImage.image2Pixel(base64_content) return imagePixel

//图片pixel信息转Matrix
await comoImage.image2Matrix(base64_content) return newImagePixel

//获取图片颜色平均值
await comoImage.image2PixelAvg(imageBase64) return number

```


### 更新日志

__2020年10月8日__

- 完成图片操作接口封装，完善使用文档

__2020年11月4日__

- 修复图片压缩功能

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