Introduction
HEIF is a container for still images and image sequences, standardised by MPEG as ISO/IEC 23008-12. A HEIC file is a HEIF file whose images are compressed with HEVC (H.265), the same codec used for high definition video. It gives files roughly half the size of a JPEG of similar quality.
Apple made HEIC the default photo format on iPhones with iOS 11 in 2017. A HEIF file
can also hold several images, depth maps, alpha planes, thumbnails and Exif metadata.
Files with other codecs inside often use the .heif extension.
Structure
A HEIF file uses the ISO base media file format, the same box structure as MP4. Each
box is a 4-byte big-endian size, a 4-byte type and its contents. The file starts with an
ftyp box, so the text ftyp appears at offset 4, followed by
brands such as heic, heix or mif1.
A meta box describes the images: which item is the primary image, the
list of items, where each item's data lies in the file, and properties such as size
and colour. The compressed image data itself sits in an mdat box. Large
photos are often stored as a grid of smaller tiles, each coded separately.
0ftyp major brand and compatible brandsvaries…meta handler, primary item, item info, item locations, propertiesvaries…mdat the coded image datavaries
In this reference
- Boxes and items – the box header, brands, and the meta box: items, locations, references and property associations
- Item properties – size, bit depth, colour codes, the HEVC configuration, rotation, mirroring, cropping and auxiliary types
- Derived images and metadata – grids, overlays, thumbnails, alpha, depth, Exif and XMP
Not described
HEIF is defined by ISO/IEC 23008-12, which is sold, not free, and was not read. The pages follow libheif’s parsing code and the free AVIF specification for the rules they share.
Known, not yet covered
- Reference: ISO/IEC 23008-12 (HEIF) itself, which is paywalled. Anything the pages say that rests only on libheif has not been checked against the standard.
- Reference: the layouts of
hvcC,colr(nclx),pasp,clli,mdcvandrloc, and the H.273 code tables, were written from memory of ISO/IEC 14496-15, 14496-12, HEIF and ITU-T H.273 and were not re-read; the order of themdcvprimaries (green, blue, red, as in the HEVC SEI) most of all (properties). ISO/IEC 14496-12 is free and can settle most of them. - Reference: which axis a set bit in
imirmeans: libheif reads bit 0 set as a horizontal axis; the standard’s wording was not checked. - Reference: boxes and properties not covered:
amve,cmin,cmex, the uncompressed-image boxes of ISO/IEC 23001-17, the internals oftmap, MIAF profile brands other thanmiaf, and the details of sequence tracks (boxes, derived images). - Viewer: there is no HEIC plugin yet. Decoding the HEVC image data would be a further task (HEVC is a patented video codec).
Unknown
- Reference: Apple’s
hdrgainmapauxiliary type is Apple’s own and is not in the standard; its layout is not published.
Links
Software
- Apple Photos and Preview – Apple’s built-in apps, which open HEIC photos (macOS, iOS)
- Microsoft Photos – the Windows photo app, which opens HEIC with the HEIF and HEVC extensions installed (Windows)
- GIMP – free image editor that opens and exports HEIF (Windows, macOS, Linux)
- Adobe Photoshop – Adobe’s image editor, which opens HEIC (Windows, macOS)
- XnView MP – image viewer and batch converter (Windows, macOS, Linux)
- ImageMagick – command-line tools that convert HEIC to other formats (Windows, macOS, Linux)
Developers
- libheif – library that reads and writes HEIF and AVIF (C)
Reference
- HEIF technical information – Nokia Technologies’ overview of the standard, with example files