178 points · by eashish93 · 7y ago · 44 comments
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.
So simple, yet so effective.
Obs: TinyJPG and TinyPNG are the same site
Also I think this is project is a good side project, regardless if it's really "necessary"
Does this project tick all of those boxes to make this production ready? I'm not sure, it certainly looks polished (I haven't reviewed the code).
If not, does anyone have a recommendation for which app does this?