Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simon-he95/transform-picture

transform-picture
https://github.com/simon-he95/transform-picture

jpeg jpg pdf png transform-picture

Last synced: 10 days ago
JSON representation

transform-picture

Awesome Lists containing this project

README

        

## transform-picture
[live demo](https://transform-image.netlify.app/)

将上传图片消除白色背景,并转换为png | jpg | jpeg | pdf 格式 下载到本地

## 安装
```bash
npm install transform-picture

import { toPDF, transformPicture } from '../../src'

async function transformPic() {
if (!baseURL)
return
output = await transformPicture(baseURL)
document.getElementById('outImg').src = output.toDataURL()
}

function download(type) {
if (!output) return;
if (type === "pdf") return toPDF(output, filename);
const a = document.createElement("a");
a.href = output.toDataURL(`image/${type}`);
a.download = `${filename}.${type}`;
a.click();
}
```

## 依赖
`vue`

`jspdf`