Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/simon-he95/transform-picture
- Owner: Simon-He95
- Created: 2022-06-19T12:07:28.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:18:24.000Z (11 months ago)
- Last Synced: 2024-03-15T15:22:57.629Z (8 months ago)
- Topics: jpeg, jpg, pdf, png, transform-picture
- Language: Vue
- Homepage: https://transform-image.netlify.app/
- Size: 204 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
## transform-picture
[live demo](https://transform-image.netlify.app/)将上传图片消除白色背景,并转换为png | jpg | jpeg | pdf 格式 下载到本地
## 安装
```bash
npm install transform-pictureimport { 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`