PicScrub logoPicScrub
Back to Formats

HEIC Format

High Efficiency Image Container

ISOBMFF Container

If you've ever worked with MP4 video files, HEIC will feel familiar. Apple chose the ISO Base Media File Format (ISOBMFF) as the container for HEIC, which means it shares DNA with video formats rather than traditional image formats like JPEG or PNG.

The format consists of nested "boxes" (also called atoms) with 4-character type codes. It's a surprisingly elegant design that allows for complex hierarchies of data while remaining relatively easy to parse once you understand the basics.

HEIC File Structure

ftyp
meta
mdat
ftyp
24 bytes
File type and brands
meta
1000 bytes
Metadata container
mdat
Variable length
Media data (HEVC)

HEIC Header (ftyp box)

Box Size (24)
Box Type (ftyp)
Major Brand (heic)
Minor Version
Compatible (mif1)
Compatible (heic)
OffsetHexASCII
0000
000000186674797068656963
....ftypheic
000C
000000006D69663168656963
....mif1heic

Box Structure

SizeTypeData
4 bytes (BE)4 bytesSize - 8

If size = 1, an 8-byte extended size follows the type. If size = 0, box extends to EOF.

Key Boxes

The box hierarchy in HEIC files can get deep. Unlike JPEG where metadata sits at predictable offsets, HEIC buries its metadata several layers into a nested structure. Here's how the main pieces fit together.

ftyp:File Type

First box in file. Contains major brand and compatible brands. Required for format identification.

Compatible brands: heic heix hevc hevx heim heis hevm hevs mif1 msf1

meta:Metadata Container

Contains all metadata including item locations, properties, and associations. This is where EXIF/XMP data lives.

meta (metadata container)
├── hdlr  (handler reference)
├── pitm  (primary item ID)
├── iloc  (item locations → offsets into mdat)
│   └── [item_id, offset, length] entries
├── iinf  (item info → find 'Exif' item)
│   └── infe entries with item types
├── iprp  (item properties)
│   ├── ipco (property container)
│   │   ├── hvcC  (HEVC decoder config)
│   │   ├── ispe  (image dimensions)
│   │   ├── colr  (ICC profile, offset+12)
│   │   ├── Exif  (EXIF in TIFF format)
│   │   └── pixi  (pixel information)
│   └── ipma (property associations)
└── iref  (item references)

mdat:Media Data

Contains the actual HEVC-encoded image data. The iloc box in meta provides offsets into mdat.

Metadata in HEIC

If you're used to JPEG's APP markers, HEIC takes a different approach. Instead of sequential markers at the start of the file, metadata lives as "item properties" inside the meta box. The actual EXIF data is still in the familiar TIFF format, but finding it requires navigating the box hierarchy first.

EXIF Property

Stored in ipco (item property container) with type "Exif". Contains standard EXIF data in TIFF format, same as JPEG.

XMP Property

XML-based metadata stored as "mime" type property with content-type "application/rdf+xml".

ICC Profile

Color profile stored as "colr" box with type "prof".

Why Offsets Matter

The iloc box contains precise byte offsets pointing into mdat. If any box sizes change (e.g., from removing metadata), these offsets must be recalculated or the file becomes unreadable.

Lossless Anonymization

Here's where HEIC gets tricky. The format was designed for efficient video/image storage, not for easy metadata manipulation.

The Challenge

HEIC's offset-based structure makes byte removal risky. The iloc box contains precise byte offsets pointing into mdat. If you remove even a single box, those offsets become wrong, and the image won't open anymore.

Zero-Overwrite Approach

Instead of removing metadata boxes, PicScrub overwrites their contents with zeros while preserving box structure and sizes.

Before: [Exif][GPS Data: 37.7749, -122.4194][Camera: iPhone]
After:  [Exif][0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00...]

Why Zero-Overwrite?

  • Preserves file integrity:All offsets remain valid
  • No recompression:Image data untouched
  • Metadata destroyed:Zeros contain no information
  • Reversible?:No, overwritten data is gone

How PicScrub Processes HEIC

1

Parse Box Structure

Recursively parse ftyp, meta, and identify all boxes

2

Locate Metadata

Find Exif and XMP properties in ipco container

3

Zero Metadata Content

Overwrite metadata box contents with zeros

4

Preserve Structure

Keep box headers, sizes, and all offsets unchanged

File Size Consideration

Because PicScrub uses zero-overwrite instead of removal, the output file size will be the same as the input. The metadata space is preserved but filled with zeros.

Input: 2.5 MB (with 50KB EXIF)
Output: 2.5 MB (50KB of zeros)

HEIC vs HEIF vs AVIF

The naming is confusing, so let's clear it up. HEIF is the container format, while HEIC and AVIF describe what codec is used to compress the image inside that container.

FormatContainerCodecUsed By
HEICHEIFHEVC (H.265)Apple devices
HEIFHEIFVariousGeneral container
AVIFHEIFAV1Web (royalty-free)

All three use the same ISOBMFF/HEIF container structure, so PicScrub's approach works for all of them.