Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Imgsquash – My image compression website project (github.com/eashish93)
178 points by eashish93 on May 27, 2019 | hide | past | favorite | 44 comments



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


I really like this. Is it maintained? I am guessing the main repo is this one? 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?


Hey, no, 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 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/pack.... There's also https://github.com/imagemin/imagemin for 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


Https://squoosh.app does this (note our team built this).

Also. Neat project op, love seeing all new projects that help with image compression.


That's a Google app right? It's also an Android app that I've installed.


Really? We didn't publish it in the store (iirc)... As a pwa it should offer an install though.


You're right.


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?

What could possibly go wrong?


No? How about when initially uploading.

Or without any uploads when it's for their own 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.


Because 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.


Because website are convenient


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.


I had not heard of youtube-dl before, thanks for the pointer.


If you have an Android, check out Newpipe as well


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.


You mean hundreds of tools that run the risk of infecting your machine with malware and bloat?


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?


At least a browser is somewhat sand-boxed to protect users, a native image tool could quite easily gain complete control of your system...


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...


Microsoft 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.


For a small scale offline alternative I can heartily recommend https://imageoptim.com.

So simple, yet so effective.


And for Linux users: https://trimage.org (disclaimer: I made this)


the chrome team released a similar tool a few months ago (https://squoosh.app). I'm curious how these compare.


There's also TinyPNG[1] (which also handles jpeg), which offers both an on-site tool as well as an API as a service.

[1] https://tinypng.com/


I usually prefer http://needsmorejpeg.com/ it really gets the size down.


Funny, I would describe it as TinyJPG (which also handles png) :)


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.

Obs: TinyJPG and TinyPNG are the same site


Take a look at https://kraken.io as well. Emphasis is on consistency of results and likeness to the original.


Thanks for sharing this and well done!


I don't see the appeal. Don't you agree it would be better if the user- ran this software on their own machines?


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"


Exactly. I sometimes upload an image to imgur for the sole purpose of re-downloading it compressed.


Most users of a tool like this don't know (or don't care) to install command line tools.


verisimilitudes didn't say that it should be a shell tool, just a local one. Personally I would prefer the option of command line or GUI.


There are GUI tools for that. Maybe the author felt there's a niche for people that don't want to install random stuff from the Internet.


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).


If it was wasm then it would be what OP comment was asking for. Locally run software.


Reminds me of smush.it from back in the day.


Does it do face stabilization over a range of images of, say, selfies?

If not, does anyone have a recommendation for which app does this?


That's not what image compression is.


What’s your usecase? Curious




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: