5 ms·
It's possible to run mozjpeg, pngquant etc.. on the browser (emscripten), to offload servers from this job Example: https://caub.github.io/misc/optim https://c
by 11235813213455 7y ago
It's possible to run mozjpeg, pngquant etc.. on the browser (emscripten), to offload servers from this job
Example: https://caub.github.io/misc/optim https://caub.github.io/misc/optim
- deleted 7y ago[deleted]
- londons_explore 7y agoHmmm... 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? What could possibly go wrong?
- Dylan16807 7y agoNo? How about when initially uploading. Or without any uploads when it's for their own use.
- llaks_72 7y agoIf 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.
- aarreedd 7y agoBecause website are convenient
- hombre_fatal 7y agoHell, 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.
- blauditore 7y agoI had not heard of youtube-dl before, thanks for the pointer.
- rakoo 7y agoIf you have an Android, check out Newpipe as well
- davidmurdoch 7y agoYou mean hundreds of tools that run the risk of infecting your machine with malware and bloat?
- llaks_72 7y agoI 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?
- anchpop 7y agoMicrosoft paint is horrible for resizing images 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.
- gitgud 7y agoAt least a browser is somewhat sand-boxed to protect users, a native image tool could quite easily gain complete control of your system...
- adrianN 7y agoWith 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.
- gitgud 7y agoTrue, 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...
- ThePawnBreak 7y agoBecause it's for your mum that doesn't know what a program is. 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.
- onion2k 7y agoActually 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.
- kinlan 7y agoHttps://squoosh.app does this (note our team built this). Also. Neat project op, love seeing all new projects that help with image compression.
- zawerf 7y agoI really like this. Is it maintained? I am guessing the main repo is this one? https://github.com/caub/im-optim https://github.com/caub/im-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?
- 11235813213455 7y agoHey, no, https://github.com/caub/im-optim https://github.com/caub/im-optim runs on node.js, server-side, and it's not maintained. Someone else mentioned https://github.com/GoogleChromeLabs/squoosh https://github.com/GoogleChromeLabs/squoosh for server-side image optimization, it might be better maintained, it seems to use webpack image optimizers plugins https://github.com/GoogleChromeLabs/squoosh/blob/master/package.json#L48 https://github.com/GoogleChromeLabs/squoosh/blob/master/pack.... There's also https://github.com/imagemin/imagemin https://github.com/imagemin/imagemin for doing this For https://caub.github.io/misc/optim https://caub.github.io/misc/optim, source: https://github.com/caub/misc/blob/master/optim.html 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/as-com/mozjpeg-js, https://github.com/psych0der/pngquantjs https://github.com/psych0der/pngquantjs