JPEG XL vs. AVIF for web use-cases

38 points | by farlight an hour ago

17 comments

  • adzm 9 minutes ago

    JPEG transcoding is one of the neatest features of JXL; there is so much existing jpeg out there. Eventually that may be unnecessary, but it's looking like this could already save a significant amount of space for photo archive backups for example.

  • adzm 12 minutes ago

    > AVIF is basically the keyframe format of AV1 video, with a bunch of still-image-specific optimisations thrown in. Animated AVIF however, is pretty much just a repackaging of AV1 video. You can convert an AV1 MP4 to AVIF and back losslessly - it's just a container change. That's why it performs so much better, because it's built for motion.

    So, is animated AVIF only keyframes / p-frames, where each frame is independent from the other? I was under that impression, uncertain if there are any other capabilities it might have (like only updating part of the canvas when only parts change, like GIF supports)

      jaffathecake 7 minutes ago

      No. I used to think this too, but it isn't limited to keyframes.You can convert an AV1 MP4 to AVIF and back losslessly - even if it has non-keyframes. It's just a different container. It has the full AV1 capability. Plus transparency.

  • quentindanjou 27 minutes ago

    Great article!

    Overall I am getting that AVIF is better on the web...unless Lossless is needed, in that case better take JPEGXL.

  • Theodores 4 minutes ago

    Jake's interest in F1 hasn't waned, which is good to see. I am presuming that picture of an Alpine/Renault at Goodwood is his 18Mb photo, but I could be wrong. Neither has his interest im image compression waned, which is also good to see. But why the move from Google to Firefox?

    I am still on webp, thinking that I am on the bleeding edge in a world where artworkers are obsessed with pixels with JPG/PNG as the only formats they know, which is an advance on GIF.

    Every browser advertises what formats it will accept and if it is in 'data-saving, low bandwidth mode', so I just configure the CDN to keep the names the same '.jpg' but to send the bestest format for the situation/browser, whether that be webp or AVIF, fetching super-high resolution files from the origin server, outputting them in 'retina' resolution with none of those 'picture' elements referencing half a dozen 'responsive' sizes.

    In this way nobody has to care what image format is being served, and if it is deemed that everything is way too compressed, the CDN can be flushed of the cached images, quality increased, and cache rebuilt.

    It looks like I will need to update my server configuration to use JPEG XL in the usual five years' time, given the lack of any revolutionary benefit.

  • dc3k 26 minutes ago

    I really hope that some day Firefox supports HDR AVIF images

      jaffathecake 6 minutes ago

      It's not AVIF that's the issue, the blocker is supporting HDR in general.

  • phoronixrly 25 minutes ago

    Ah, Chrome ships JXL when we already have a better codec for the web!

      lern_too_spel 14 minutes ago

      PDF standardized on JPEG XL, and Chrome ships with a PDF renderer.

  • 0xy 17 minutes ago

    AVIF is a lifesaver for animation with separate transparency layers so the transparency can change position frame by frame. The only other alternative is WebM which has Safari limitations.

      jaffathecake 4 minutes ago

      But the performance is so bad it isn't worth using. You're better off encoding a double height AV1 and mashing it together with WebGL https://jakearchibald.com/2024/video-with-transparency/. That's how bad the situation is.

      adzm 10 minutes ago

      Is there an advantage to this as a separate layer compared to just having an alpha channel baked into the image data itself? If not premultiplied then it would not affect the other channels either.

  • shmerl 30 minutes ago

    I think one overlooked aspect is that AVIF is container based. Meaning that once sites support, when AV2, AV3 etc. will come out, there won't be a need to go through another very difficult phase of sites adoption - it will still be AVIF just with newer codec inside, and it will be just up to browsers to catch up on newer versions and newer codecs will address technical needs as times goes.

    JPEG XL doesn't have that benefit, while sites adoption is arguably a worse issue than browser adoption.

    To demonstrate the point even for AVIF itself - it has been in the browsers for a while. Can you use it on common sites? Good luck if you can, even major sites like GitHub and GitLab have issues with it due to some site code depending on hardcoded list of known formats or other similar problems.

      jaffathecake a minute ago

      This doesn't make sense to me. There's enough content negotiation out there that AV2 will need a new content-type parameter. Feature detection is important to browsers.

      theandrewbailey 3 minutes ago

      > I think one overlooked aspect is that AVIF is container based.

      Many other image formats are. AVIF uses HEIC, the same container that HEIF does.

      > when AV2, AV3 etc. will come out, there won't be a need to go through another very difficult phase of sites adoption - it will still be AVIF just with newer codec inside, and it will be just up to browsers to catch up on newer versions and newer codecs will address technical needs as times goes.

      Fingers crossed, but AV2-based AVIF specs have yet to be finalized, so who knows.

      pornel 8 minutes ago

      The container is useless. Files based on a newer codec won't display anyway.

      ISO-BMFF container is bloated and needlessly complicated. AVIF decoders didn't even want to reuse existing MP4 libraries for it due to all the baggage it brings, and implemented their own minimal parsers.

      AVIF would have been better off with a simple wrapper similar to RIFF/PNG or extending AV1's own OBU header (which for inexplicable reason gets its data duplicated inside the HEIF container and then implementations are required to verify that both copies agree!)

      I hope AVIF will skip AV2. We don't need yet another almost-identical format to migrate to.

      arendtio 8 minutes ago

      Can someone please explain the downvotes?