Apple ImageIO AVIF Decoding on iOS and macOS

Apple’s ImageIO framework provides native, system-level support for decoding AV1 Image File Format (AVIF) files across iOS and macOS. This article details the operating system requirements, the underlying mechanisms ImageIO uses to parse and decode AVIF assets, hardware acceleration advantages on newer Apple Silicon chips, and how developers interact with the framework to load these images efficiently.

Platform Availability and Container Architecture

Apple introduced system-wide decoding support for AVIF starting in iOS 16 and macOS 13 (Ventura). Because AVIF uses the ISO Base Media File Format (ISOBMFF)—the same foundational container standard used by HEIF—Apple was able to integrate AVIF decoding directly into the existing ImageIO architecture.

Within ImageIO, the format is identified by the uniform type identifier public.avif. The system parses the container structure, extracts the AV1-compressed bitstream from the file's item data, and delivers standard bitmap representations to client applications.

Decoding Mechanics via CGImageSource

Decoding an AVIF image with ImageIO requires no specialized third-party dependencies. The process relies on standard Core Graphics and ImageIO functions:

  1. Creating the Image Source: Developers initialize a CGImageSourceRef from raw data, a file URL, or a data provider using functions such as CGImageSourceCreateWithURL or CGImageSourceCreateWithData.
  2. Reading Image Properties: ImageIO reads container metadata without decompressing the pixel payload. Functions like CGImageSourceCopyPropertiesAtIndex reveal essential dimensions, color profiles, orientation, and bit depth.
  3. Decompressing the Frame: Calling CGImageSourceCreateImageAtIndex triggers the decompression of the AV1 bitstream into a CGImageRef.

ImageIO performs lazy decoding, deferring full decompression until the image is requested for rendering or caching, which minimizes memory overhead.

Hardware vs. Software Decoding

Decoding performance depends on the device's hardware profile:

Color Profiles, HDR, and High Bit Depths

AVIF supports 8-bit, 10-bit, and 12-bit color depths along with High Dynamic Range (HDR) mastering (such as PQ and HLG transfer functions). ImageIO natively parses these embedded color profiles and signaling parameters. When decoding an HDR AVIF file, ImageIO yields an image context that retains wide-gamut (Display P3) and HDR headroom data, allowing UIKit, AppKit, and Metal to render the content accurately on Extended Dynamic Range (EDR) displays.

Integration with High-Level Frameworks

Higher-level frameworks utilize ImageIO's AVIF pipeline under the hood: