Hacker News new | ask | show | jobs
by vladdanilov 2790 days ago
> Compress your JPG images with the compression level of 70‑80.

In practice some images can get noticeable artifacts even at around 90. Most of JPEG compressors always apply chroma subsampling which is often destructive on its own [1]. On the contrary, many hidpi images can be compressed at around 50.

> Use Progressive JPEG… Thanks to this, a visitor can roughly see what’s in the image way earlier.

That's not the point of using progressive JPEGs nowadays. The 10-200% decompression slowdown is for the 5-15% size reduction.

> Use Interlaced PNG.

Don't. Interlaced PNGs can easily be 1/3 bigger. There are better ways to show loading images, and it's already used on the website.

> webpack has image-webpack-loader which runs on every build and does pretty much every optimization from above. Its default settings are OK

> For you need to optimize an image once and forever, there’re apps like ImageOptim and sites like TinyPNG.

These tools are no good for automatic lossy image compression [1]. The default is mostly JPEG 4:2:0 at quality 75, PNG quantized with pngquant at settings as low as conscience allows, missing out many PNG reductions and optimal deflate, no separation between lossy and lossless WebP if at all, etc.

As a result, the images on the website have about 13-24% more to optimize losslessly.

[1] https://getoptimage.com/benchmark

2 comments

> These tools are no good for automatic lossy image compression

The self-promotion didn't bother me until this claim, because you posted some great advice along with it.

ImageOptim is great. If you choose "lossy minification" it does automatic lossy image compression, preserving perceptual image quality while making huge reductions to file sizes. Users can even adjust how aggressive it is.

I'll take your word for it that I could get 13-24% smaller file sizes with your Optimage product on top of the 80% (or whatever) that I can get with ImageOptim. But I'd prefer that you didn't claim that other choices are "no good".

I specifically meant automatic lossy compression with predictable visual quality. If ImageOptim could actually achieve it (automatically), that would save me and others an awful lot of time. But as it turns out it is not that easy.

Some very smart people at Google go to the trouble of creating projects like Guetzli. I personally have spent months on this, and it gets me every time someone claims "just use that one tool" without any evidence. I presented mine and it's reproducible.

ImageOptim is a great tool otherwise.

> [1] https://getoptimage.com/benchmark

A score of 24/55 for TinyPNG and then 55/55 for their own service makes it look as if this article is an advertisement. Especially since TinyPNG gets better/very similar file size while staying visually lossless up to a point (images where it's nothing but a bunch of rainbow gradients are its weakness).

Remember that TinyPNG is optimized for web use where artifacts are tolerated. It was configured with that in mind. They test for images that are visually identical and won't get it from any images optimizer that is made for web usage.

Users only spend a few seconds looking at images that on web pages and the artifacts from optimizers are very minor. See: https://3perf.com/talks/web-perf-101/#images-compress-jpg-si...