drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.56k stars 480 forks source link

Identifying Master Image in HEIF File with Multiple Images #373

Open payton opened 5 years ago

payton commented 5 years ago

Expected Behavior

Metadata-Extractor will display the image properties of a HEIF file's master image

Current Behavior

Metadata-Extractor displays the image properties of the first image instance

Detailed Description

An issue I noticed using the sample image from #362 is there are multiple of the same Image Property boxes in a single HEIF (in this case, HEIC) file. As per the ISO/IEC 23008-12:2017 documentation, there are a few different types of images: General, Hidden images, Cover image, Thumbnail images, Auxiliary images, Master images, Pre-derived coded images, and Multi-layer images.

This caused an issue with identifying/displaying the correct property. In the sample image referenced above, we parsed three ImageSpatialExtentsProperty boxes (responsible for extracting width and height). However, we only store the first found instance. As a result, that sample image is being displayed as 512x512 px, but it should be 4032x3024.

When I print out each ImageSpatialExtentsProperty instance, it shows we find three sets of dimensions: 512x512, 4032x3024, and 320x240.

Next Steps

This will require some further research in how HEIF stores multiple images. Do we display all properties or limit it to the master image? How to we deal with single images vs image collections vs image sequences? The necessary documentation can be found here. This may reference other ISO documents, which can also be downloaded here.