1.0.6 • Published 1 year ago

image-to-webp v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

image-to-webp

Convert Image (JPG/PNG) to WebP for good compression and better performance. Resulting in faster website load.

https://www.npmjs.com/package/image-to-webp

Installation

npm i image-to-webp

Example

const { imageToWebp } = require("image-to-webp");

const outputFilePath = await imageToWebp("./myimg.jpeg",90); 

console.log(outputFilePath);

Options

  1. imagePath: provide string image path here, you can provide the temporary uploaded image path which is returned by packages like Formidable or Multer.

  2. quality: it accept number value from 0-100, 0 (For high compression and lossy image), 100 (Less compression). Defult value is 80.

imageToWebp() function returns the path of Converted WebP image. this package stores all images to temporary folder. so using returned path by this method, either you can move the image from tmp directory to public directory in your backend or upload it to any cloud storage provider such as AWS S3.

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago