A client-side JavaScript image compression library that uses the Canvas API to compress images in the browser before upload. Current stable version is 2.2.2, released periodically with bug fixes and improvements. Key differentiators: returns Blob objects (not base64) for accurate size tracking, supports EXIF orientation correction for Android/iOS images, offers configurable max dimensions and quality, and provides a clean async/await API. Alternative to compress.js library with better option handling and bug fixes. Does not work in Node.js (browser/Canvas only). Limitations: transforms PNG transparency to black background, and GIFs lose animation.
npm install client-compressNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Compress instance with options, compresses an array of image Files, and displays the first result using a Blob URL.
Use Blob data directly or call Compress.blobToBase64(photo.data) if you need base64.
Re-test compression results and adjust quality/maxDimensions.
Use an image editor or alternative library if alpha preservation is required.
Skip compression for animated GIFs, or use a GIF-specific library.
Use server-side alternatives like sharp or image-min.
Switch to ESM import syntax if your project supports it.
Change import statement to: import Compress from 'client-compress';
Run 'npm install client-compress' and ensure import is from 'client-compress' without subpaths.
Ensure the image server sends Access-Control-Allow-Origin header or load images from same origin.
No dependency data recorded yet.