Retrieving image metadata (orientation) when using new PhotosPicker and PhotosPickerItem

Is it possible to retrieve image metadata without requesting additional permission with the new SwiftUI PhotosPicker? I can access metadata when using picker( _ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) by using itemProvider. But for PhotosPicker, it seems that it's only possible by firstly retrieving PHAsset from PhotosPickerItem, and then by using requestContentEditingInput. Which require authorization for specific photo

Replies

Does this solve your problem?

https://codermite.com/t/extracting-image-meta-data-from-a-picture/

PhotosPicker supported asset metadata without library access. You don't need to use PHAsset.

You can use Transferable to extract Data or URL from the PhotosPickerItem, then you can read asset metadata just like NSItemProvider.

  • Could you please give a quick example of how you would code that or link to an existing example online?

Add a Comment