How HEIC Containers Store Separate HEVC Thumbnail Items & Clean Aperture Crops
Why HEIF Uses `iref` `thmb` Items Instead of EXIF IFD1 JPEGs
In classic JPEG files, camera previews sit inside TIFF IFD1 as tiny 160×120 baseline JPEGs. In ISO/IEC 23008-12 HEIC files, iOS stores the fast gallery thumbnail as its own dedicated hvc1 item marked hidden in iinf and bound to the full-size photo via a thmb entry inside ItemReferenceBox (iref).
Because HEVC minimum coding tree blocks pad tiny dimensions up to multiples of 16 pixels, small thumbnails attach a CleanApertureBox (clap) in ipma to crop decoded pixels back to exact aspect-accurate dimensions. In rotated-aux-thumb.heic, Item ID 2 is coded in a 16×16 HEVC block and cropped by Property 7 (clap) to 8×6 pixels.
- Fetches the hidden thumbnail handle directly by item ID via libheif context inspection.
- Privacy note: cropped photos edited poorly can retain uncropped pre-edit pixels inside stale thmb items.
- Falls back gracefully to the primary image while reporting thumbnailCount=0 when no preview exists.
Auditing Privacy & Aspect Mismatches Between Preview and Master
Comparing thumbnail aspect ratio (8×6 landscape) against Master Item 1 post-irot display dimensions (24×32 portrait) immediately reveals whether a preview omitted the master rotation property—explaining why certain file managers show a sideways icon until the full photo opens.