Explainers
What’s Inside an iPhone HEIC Photo? 45 Tiles and a Brightness Map
VeryEasyTools · 4 min read
iPhone photos have the .HEIC extension. Open one and it’s just a picture, but the file is more complicated than you’d expect. I took apart one iPhone 17 photo (5712 × 4284, 2,447,845 bytes), following the rules of the file format.
A HEIC file is a set of boxes
HEIC follows a format called HEIF. HEIF uses the same skeleton as MP4 (the ISO base media file format), so the whole file is made of labeled boxes. This photo had three at the top level:
ftyp: a label saying what kind of file this ismeta: a table of contents listing what’s inside, how the items relate, and properties such as size and typemdat: the actual image data
The table of contents (meta) listed 119 items. The rest of this article explains why one photo has so many.
| Item type | Count | What it does |
|---|---|---|
| hvc1 | 111 | Image tiles compressed with HEVC |
| grid | 3 | Blueprints that join tiles into one large image |
| tmap | 1 | Rules for applying the brightness map (ISO 21496-1) |
| mime | 2 | Descriptions of helper images (XMP) |
| Exif | 1 | Shooting information: date taken, device, exposure and so on |
| uri | 1 | Extra information used by Apple |
The picture is stored in tiles
The main picture (5712 × 4284) isn’t one piece. It is split into 45 tiles of 640 × 896, and a grid item says to join them 9 across and 5 down. The tiles at the edges spill slightly past the picture; after joining, the result is cropped to the right size.
The usual explanation for tiling is the video chip. A phone’s HEVC decoder has a maximum size it can decode at once, so feeding it many small tiles is faster and uses less memory than pushing 24 megapixels through in one go. Tiles can also be decoded in parallel.
Another photo from the same iPhone, taken on a different day (4032 × 3024), had 48 tiles of 512 × 512. Tile size changes with the shooting settings.
Five more pictures besides the main one
The table of contents also listed helper images attached to the main picture. Their names (the auxC property) tell you what each one is.
| Image | Size | Data | What it does |
|---|---|---|---|
| Main picture | 5712 × 4284 | 1,931,770 bytes (79%) | The photo you see |
| hdrgainmap | 2856 × 2142 | 247,262 bytes (10%) | Brightness map: where to show the picture brighter, and by how much |
| styledeltamap | 4096 × 3072 | 114,009 bytes (5%) | A difference map apparently used to change the Photographic Style after the shot |
| semanticskymatte | 2016 × 1512 | 24,509 bytes | A map marking where the sky is |
| linearthumbnail | 1024 × 768 | 13,829 bytes | A small image Apple uses (its purpose isn’t documented) |
| Preview | 416 × 312 | about 20 KB | A small image for quick display in lists |
Other photos also had maps of people’s outlines and skin (portraiteffectsmatte, semanticskinmatte). This one is a night scene with no people, so those were nearly empty at 746 bytes each. The Photos app can still adjust portrait blur or tone after the shot because the ingredients are stored inside the file.
The brightness map is 10% of the photo
The most striking item is the brightness map (gain map). It is half the size of the main picture (2856 × 2142) and takes up 10% of the whole file.
HDR screens can go brighter than ordinary screens. The brightness map is a grayscale image that records which parts of the photo to show brighter, and by how much. The Photos app multiplies the main picture by this map so that lamps, sky and reflections glow as they did in real life. How much brighter it can go is recorded in the XMP value HDRGainMapHeadroom (2.12 for this photo) and in the tmap item. tmap follows an international standard shared by several companies (ISO 21496-1), while the XMP value is Apple’s own method. This photo carries both.
Why it can look darker elsewhere
The main picture and the brightness map are stored separately. If a program reading the HEIC takes only the main picture and throws the map away, the bright areas you saw in Photos are gone, and the picture looks comparatively dark and flat. This often happens when a HEIC is opened in a browser and saved in another format, or when a messaging app recompresses a photo. Even when I saved what the browser read as a lossless PNG, it came out darker than the original in Photos. The cause isn’t compression: the brightness map is dropped at the reading step.
To keep the brightness, the map has to be extracted and put into the new file too. JPG can carry a brightness map the same way (an ISO 21496-1 gain map JPG), and the iPhone Photos app shows such JPGs in HDR. This is what Compress Image does when it turns a HEIC into a JPG. It can’t help, though, if whoever receives the photo recompresses it and drops the map. Ways to turn the effect off or tone it down on iPhone are covered in why iPhone HDR photos look dull in other apps.
What tiles and helper images mean for file size
Of this 2.4 MB photo, the main picture is 79%; the other 21% is the brightness map, helper images and information. HEIC is known for being smaller than JPG, but a real iPhone HEIC carries all these ingredients, so it is somewhat bigger than the pixel count alone would suggest. Converting to JPG and discarding every helper image makes the file that much lighter, but features such as changing the Photographic Style or HDR brightness disappear with them.