Hacker News new | ask | show | jobs
by fbdab103 926 days ago
What is the modern power ranking on image formats?

For lossless, what is typically the most efficient size wise? Decompression speed?

For lossy?

I am not in a situation where these micro-optimizations mean much to me, and always default to png, but curious to know where the state of the art is today.

3 comments

AVIF and WebP, two modern replacements for both JPEG and GIF on the web, both support lossy and lossless encoding.

WebP is mature and has more browser support, but AVIF is getting there (notably only lacking Edge support). Both can compress in either a lossy JPEG-like fashion or in a lossless PNG-like fashion.

If you use a image CDN like Imgix, it'll just auto-detect and serve whatever the most optimal format is anyway: https://docs.imgix.com/apis/rendering/auto/auto#format. Cloudinary too: https://cloudinary.com/documentation/image_optimization#how_...

For non-web, there's also JPEG XL to look at, but if you're not doing rendering an image for redistribution, it's probably better to keep it as raw as possible anyway (i.e. camera raw images plus photoshop layers, or whatever).

WebP and AVIIF (and, to a much lesser extent, HEIC, which AVIF is basically a rip off of) absolutely suck for color management since they are a) virtually never original source formats, b) are video codecs. WebP technically supports two different color profile techniques (traditional embedded ICC - broken in every mainstream batch image processor I’ve tried - and nlx video-based color profiles). Unlike WebP and all the other image formats, untagged AVIF can’t be assumed to be sRGB (in part because there is no actual sRGB for video, though close variants exist) and every image processor or image editor will open it with a different base color profile assigned. WebP doesn’t even support exif, making it absolutely horrible for “lossless” operations that effectively aren’t lossless since they necessarily destroy metadata.

HEIC is also a video codec at heart but has a default color space that also isn’t sRGB (which is a good thing; it’s about time we moved on), untagged HEIC images can (though often aren’t in any default workflow) be assigned Display P3. Assigning/assuming sRGB will absolutely break your images, of course.

The worst part about avif support in edge is it was added as an optional feature flag ~8 months ago but it still isn't enabled as a default. Nearly every other browser supports avif by default these days.

https://winaero.com/avif-support-is-now-available-in-microso...

>What is the modern power ranking on image formats?

I will assume this can be outside the web and consider only image format / codec that is state of the art.

>For lossless, what is typically the most efficient size wise? Decompression speed?

In terms of lossless, JPEG-XL is the one to look at. Both in terms of size and decompression speed. You will already see communities from professional photographers using this format.

>For lossy?

That depends on what sort of quality you are looking for. In some edge cases you could have JPEG XL being better at ultra low bit per pixel, like 0.1 bpp. Otherwise in 95% of cases, at 0.1 bpp to 0.5 bpp, it is HEIF / AVIF. HEIF based on VVC / H.266 Encoder likely to be the state of the art. With current reference FVC / H.267 implementation bringing another 10 - 30% improvement.

However the higher the quality you go, i.e 0.8 to 1.5 bpp, the more favourable to JPEG XL.

As others have mentioned, the pool is webp, avif, and jpeg-xl.

If you’re building something today, webp likely has the best tradeoff of encoding speed, efficiency, and compatibility.

For pure tiering, here’s how I’d rank them:

*Efficiency:*

Webp: B tier

AVIF: A tier

JXL: S tier

*Encoding Speed:*

Webp: B tier

AVIF: D tier

JXL: A tier

*Compatibility*

Webp: A tier

AVIF: B tier

JXL: D tier

What about mozjpeg?