image-edit
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

image-edit

eazy image compress client web library.

Demo

Get Started

yarn add image-edit

Usage

<input type="file" id="file" accept="image/*" />
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)
  }
})

Options

  • fillStyle
  • rotate
  • scaleX
  • scaleY
  • width
  • height
  • maxWidth
  • maxHeight
  • minWidth
  • minHeight
  • quality
  • mimeType

Licence

MIT

Package Sidebar

Install

npm i image-edit

Weekly Downloads

7

Version

0.2.5

License

MIT

Unpacked Size

4.17 MB

Total Files

26

Last publish

Collaborators

  • kameikazuto