Why WebKit supports AVIF but Safari does not

WebKit added support for the AVIF image format in April 2021, but it’s still unavailable in Safari. Its absence is because Apple chose an unconventional method for decoding images in its browser.

WebKit, AVIF, and Safari

It took Apple ten years to add WebP support – the successor to JPEG and PNG image formats – to its Safari browser. Apple’s refusal to add WebP support delayed its use by webmasters, designers, and developers primarily because Safari is the dominant browser on mobile devices.

While it was technically possible to serve WebP images before Safari supported them, it wasn’t practical. Web designers and developers either had to create multiple image types for the same image or pay for a service like Cloudflare’s Polish to automatically swap out JPEG and PNG images with WebP images for browsers that support WebP.

We are now entering familiar territory with a new image format called AVIF. AVIF is superior to WebP, and it has early support from Chrome and Firefox, but it’s noticeably absent, yet again, in Safari.

In April 2021, ChangSeok Oh, a WebKit contributor, added AVIF support to WebKit, providing hope to web designers and developers that Safari would soon gain support for AVIF. When the new Safari beta was released months later, AVIF support was missing.

I reached out to Philippe Normand, another WebKit contributor that worked on the AVIF feature, and asked him why Safari still didn’t support AVIF. Normand told me that while AVIF support was added to WebKit, it was only functional in the WebKitGTK (Gnome’s browser engine) and WPE (a browser for embedded devices) ports, not the Apple Safari ports.

While communicating with Normand, I serendipitously stumbled upon a podcast episode entitled, Is Safari the new IE?. The podcast hosts were Surma, Web Platform Advocate at Google, and Jake Archibald, Developer Advocate at Google, and they used the episode to share their collective frustrations about the way Apple approaches WebKit development.

Amongst the amusing banter, Surma mentioned that Safari has WebP support, but it’s actually not in Safari. He said it’s in the operating system and Safari hooks into the OS. He went on to lament that he thinks it’s an unnecessary delegation and that every other browser handles image decoding within the browser package.

On August 11, 2021, the delegation of image decoding to the OS for Safari was confirmed by Sam Sneddon, a software engineer at Apple that works on WebKit. Sneddon added a comment to the WebKit AVIF ticket and stated why AVIF isn’t supported in Safari yet. They confirmed that image decoding isn’t done by the browser, it’s done by the operating system.

The Apple ports use the system-provided image decoding capabilities; we’re unlikely to deviate from that here, so any support for AVIF depends on underlying OS support. I can’t comment as to whether any future OS releases will support AVIF.

Sam Sneddon’s comment on the WebKit AVIF decoding support ticket

The reason why Safari doesn’t support AVIF is that Apple hasn’t added AVIF support to iOS, iPadOS, and macOS.

One of Surma’s and Archibald’s complaints about Safari was that Apple only releases two major updates with new features per year, and they coincide with OS updates, while Chrome and Firefox release updates every 6-8 weeks. The current betas for macOS 12 (Monterey) and iOS 15 don’t support AVIF, which means Safari doesn’t support AVIF. If the new operating systems ship without AVIF support this Fall, it could mean that we’ll have to wait at least six months before Safari supports AVIF, or significantly longer.

Related News

Jon is the founder of Coywolf and the EIC and the primary author reporting for Coywolf News. He is an industry veteran with over 25 years of digital marketing and internet technologies experience. Follow @henshaw