← Back to context

Comment by arghwhat

8 days ago

The assumption is that a file is read more than it is written. If you spend less time and power compressing the file, you will spend more time and power delivering the file, and often not save anything on the decompression side.

If you want to optimize the user-facing side, you might want to pick HEIC instead to optimize for commonly available HEVC/h.265 hardware encoding capabilities, or to be selective instead and pick AVIF when AV1 capabilities are present.

AVIF is notoriously CPU-intensive to compress without acceleration, but assuming you pay for storage and/or delivery, the results are impressive. JPEG-XL and HEIC also do very well. JPEG really shouldn't be used unless you're trying to target devices that can only read JPEG.

HEIC/h.265 is not supported on Windows 11 by default. You have to pay for an additional decoder that currently costs $0.99 in the Windows Store. Although SOME OEMs provide pre-installed h.265 decoders with hardware acceleration.

So don't do that, please.

  • Windows 11 is not an image viewer. Your applications that view images bundle the decoders they need.

    For various reasons, AVIF and HEIF/HEIC support is generally bundled together in the same decoders. Both of CrabbyAVIF and libheif, for example, read both AVIF and HEIF/HEIC, so while HEIC might sometimes be supported without AVIF, it's harder to have support for AVIF with HEIF/HEIC.

    Browsers are a bit weird, not sure why they haven't enabled support.

    (It would be an entirely new thing for you to use hardware decoders for stills, so no reason to worry about it as something restrictive.)

    • Windows 11 has various image viewers that come built in, that allow you to view images that have been downloaded. There's Image Viewer. And Windows Photos, for example, File Explorer displays thumbnails. The screenshot utility. And I'm sure many others.

It is irrelevant that an image gets read more then written, if the user needs to wait 120 seconds (2 minutes) when uploading 10 images, instead of waiting 6 seconds for all of those 10 by using simple jpeg.

Regarding HEIC, you know the browser acceptance for this, do you? https://caniuse.com/?search=heic

  • It is not only relevant, it is the sole justification for the existence of compression in the first place.

    120 seconds is an arbitrary number to throw out there, AVIF compression time is purely dependent on how aggressive you want the file compressed. The ability to go completely nuts with computation is great for when you create the assets once for example.

    Native browser support for HEIC is poor, yes. No idea why tbh, the underlying libraries generally support it. Heck, AVIF and HEIF/HEIC support is almost universally bundled together.

    Take CrabbyAVIF and libheif: both provide both AVIF and HEIF/HEIC support. Android uses CrabbyAVIF as the platform AVIF/HEIF reader for reference, and considering that Google Photos natively supports HEIF/HEIC (even in browser). They're also using CrabbyAVIF in Chromium, but for some reason they disabled the HEIF/HEIC feature.

    If you're making browser apps, you will ultimately care about storage and bandwidth, so AVIF or JPEG-XL are your main options. Outside browser apps you can pick entirely as you please, and if end-user encoder performance matters, HEIC ends up likely winning as hardware AV1 encoders are still less common.