Portrait flag detection

PHAsset.mediaSubtypes.contains(.photoDepthEffect) exposes the portrait/depth-effect flag through PhotoKit.

Is there a way to detect the same Photos “Portrait” classification when reading the image file directly using ImageIO? I've found that key 25 in kCGImagePropertyMakerAppleDictionary appears to correlate with the Portrait flag. Is the existence of this key a stable signal for that classification, or should I use another ImageIO signal?

Thanks!

Answered by Engineer in 892475022

There is no API for detecting this on a given image just based on the metadata.

What you've theorized with the presence of a specific Markernote key is not a suitable check for these types of images. In general, the values in Makernote dictionaries are intended to be private and opaque.

Accepted Answer

There is no API for detecting this on a given image just based on the metadata.

What you've theorized with the presence of a specific Markernote key is not a suitable check for these types of images. In general, the values in Makernote dictionaries are intended to be private and opaque.

Portrait flag detection
 
 
Q