imagemin
compressorjs
Our great sponsors
imagemin | compressorjs | |
---|---|---|
2 | 8 | |
5,466 | 4,928 | |
0.0% | - | |
0.0 | 2.1 | |
over 1 year ago | 10 months ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
imagemin
-
Compressing images on client side before upload
(I checked out : imagemin, compress.js, compressorjs and some small others)
-
The Ultimate Eleventy Template for your blog with a FREE minimalist theme [Open Source]
✨ Compress image with Imagemin
compressorjs
-
Client-side image compression with Supabase Storage
After researching a couple of different options, what I landed on was a package called compressorjs written by Chen Fengyuan. This library performs compression and resizing of images in the browser. I was a bit skeptical at first, but it's a cool project and has good browser support. How Compressorjs works is that it uses the HTML5 canvas element to read the original image data and perform lossy transformations to compress and resize the image. There's a whole bunch of transformation options. For my project, what I have found is simply changing the maximum width of the image to 600px and slightly reducing the quality has greatly reduced the file sizes.
-
One Click to Optimize Images, Create Repo and Making Commit
You can change image quality or pass different options. I set customized mimeType and width by passing option parameter here. You can find more usages from compressor.js original documentation.
-
How to compress images on client-side
I will use compressorjs, a tiny librarie (3.8 kB minzipped). Compressor.js uses the Browser's native HTMLCanvasElement.toBlob() API to do the compression work, which means it is lossy compression.
There's a live Demo to play with it.
-
Compressing images on client side before upload
(I checked out : imagemin, compress.js, compressorjs and some small others)
-
12 JavaScript Image Manipulation Libraries For Your Next Web App
MORE INFO
-
Made a Web App to reduce Image Size by up to 90%, No file Size Limit & Works Offline | compressimage.io
You don't actually need any web services. Just import the compressorjs library and the UPNG.js library on client side(frontend) and then before uploading the data to server compress the image. These libraries were actually written for frontend compression by their respective owners. https://github.com/photopea/UPNG.js (25kb) https://github.com/fengyuanchen/compressorjs (8kb)
What are some alternatives?
sharp - High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
cropperjs - JavaScript image cropper.
minimize - Minimize HTML
UglifyJS2 - JavaScript parser / mangler / compressor / beautifier toolkit
pica - Resize image in browser with high quality and high speed
UPNG.js - Fast and advanced PNG (APNG) decoder and encoder (lossy / lossless)
HTMLMinifier - Javascript-based HTML compressor/minifier (with Node.js support)
babili - :scissors: An ES6+ aware minifier based on the Babel toolchain (beta)
clean-css - Fast and efficient CSS optimizer for node.js and the Web
squoosh - Make images smaller using best-in-class codecs, right in the browser.
jimp - An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.