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?
Hmmm... So you're proposing to get a client to download a big jpeg, to resample to the right resolution, then re-upload to the server for other clients to use?
If they don't need to upload it why are they using a web browser at all? There are literally hundreds of programs that integrate tools to compress images.
Hell, I just used a .doc to .epub transcoding website today because I couldn't be bothered to look up a local tool for the job much less download it and read its docs.
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.
Actually there aren't. There are 5 that do it well - MOZJpeg, PNGQuant, TinyPNG, svgo, and jpegtran. Additionally there are tools for compressing to WebP, guzelti and other new but useful formats. None of these tools are exactly friendly, they change rapidly, and installing them is quite hard (compile-from-source hard in some cases), and some need dependencies to be installed separately.
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.
I know microsoft paint is bloat but I wouldn't go so far as to call it 'malware'. It's more like adware.
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?
With the native image tool you have much more control about when you want to upgrade. The risk of someone replacing a trusted tool with a malicious version is lower when the tool is managed by apt or brew or whatever you use on Windows.
True, but in some cases (like small tools like this) I prefer the sand-boxed nature of web apps. Downloading a random tool, - even to test with - can be malicious...
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.
Not sure why the downvoting, because I do use the https://tinyjpg.com/ website and when people ask for it the name that comes to mind is "TinyJPG". The opposite of the parent.
At least for me there's been plenty of times where I just want to m I nify a single image, and potentially on a machine I don't have all my dev tools on.
Also I think this is project is a good side project, regardless if it's really "necessary"
Sure, but sometimes things are not that easy. Have you tried using mozjpeg ? You need to download, compile and install mozjpeg. Atleast for my platform. And sometimes you need the exact set of configure flags or build flags. Still you won't use a browser tool which does it for you ?
Better in which way? With Web assembly I've heard the performance can be on-par with C. In terms of ease of install: the user requires no setup step or "download". In terms of network performance: Provided caching is setup correctly and code downloads once, I don't see the harm.
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).
Example: https://caub.github.io/misc/optim