Compressor.js

Compressor.js is a JavaScript library for compressing image.

Why Compressor.js? You can use it pre-compress client images before uploading them, which can save you and your users time on uploads.

However, it's important to note that the Compressor.js uses the Browser's native HTMLCanvasElement.toBlob() API to do the compression work, which means it is lossy compression.