Example: https://caub.github.io/misc/optim
Example: https://caub.github.io/misc/optim
If not, can people point me to another out of the box solution?
My use case is that I don't want to build an entire image preprocessing/thumbnailing pipeline for image uploads. But if I serve the raw image that the user uploaded, they are typically not optimized for the web. Since I am letting the user upload anything anyway, it doesn't matter whether the image processing is secure (e.g., he can totally reverse engineer the js to upload a non-compressed image, but so what). Client side compression is a pretty elegant solution since you won't even have to pay for cpu cost to process the image. If you don't care to keep the original, it will even speed up the image uploads since they are now smaller. I really see no down sides to doing this?
For https://caub.github.io/misc/optim, source: https://github.com/caub/misc/blob/master/optim.html, and it runs the following optimizers (compiled with emscripten to run browser-side) from a Web Worker: https://github.com/as-com/mozjpeg-js, https://github.com/psych0der/pngquantjs
Also. Neat project op, love seeing all new projects that help with image compression.
What could possibly go wrong?
Or without any uploads when it's for their own use.
The website worked and I moved on with my life. I'd probably even still be using Youtube to .mp3 websites had I not happened to have experience with youtube-dl.
Also running any script in your browser is downloading, and running anonymous code giving it a playground to do whatever it wants. I'd trust the guys maintaining imagemagick or ffmpeg in my little corner of the web over the security team for firefox. Smaller attack surface y'know?
Most people don't have imagemagick installed or know how to use the commandline, and even people who do might want to quickly resize an image on a friend's computer, or something.
Because you're in a place where you don't have the right to install new software.
Because it's quicker.
Because it's OS independent.
Because you don't need to update it.
There are GUI tools for image compression but mostly they're wrappers around the libraries that drive the apps I've listed, but a few versions behind. They're not great.
Using a browser based app or service is ideal for compressing a handful of images.