easy edit image client library
npm install image-editeazy image compress client web library.
``shell`
yarn add image-edit
`html`
`javascript
import edit from 'image-edit'
document.getElementById('file').addEventListener('change', async (e) => {
const file = e.target.files[0];
if (!file) {
return;
}
try {
const imageData = await edit(file, { quality: 0.7, mimeType: 'image/webp'})
const fromData = new FormData()
formData.append('file' imageData, file.name)
await fetch('/path/to/upload', {
method: 'post',
body: formData
})
} catch (err) {
console.log(err)
}
})
``
- fillStyle
- rotate
- scaleX
- scaleY
- width
- height
- maxWidth
- maxHeight
- minWidth
- minHeight
- quality
- mimeType
MIT