dimonovdd / Xamarin.MediaGallery

This plugin is designed to picking and save images and video files from native gallery of Android and iOS devices and capture photos
MIT License
148 stars 18 forks source link

GPS metadata of images taken with the CapturePhotoAsync method is set to 0. #102

Closed bizyyosh closed 1 year ago

bizyyosh commented 2 years ago

Description

Images taken using the CapturePhotoAsync method do not contain GPS information.

The info.plist describes the permissions for using the camera and location information.

I am not familiar with development on iOS. I don't know if the plugin is the cause. Any advice would be appreciated.

Expected behavior

Latitude and longitude of the shooting location are included in the meta data.

Steps to reproduce the behavior

if (!MediaGallery.CheckCapturePhotoSupport())
    return;

var status = await Permissions.RequestAsync<Permissions.Camera>();

if (status != PermissionStatus.Granted)
    return;

using (var file = await MediaGallery.CapturePhotoAsync())
{
    var stream = await file.OpenReadAsync();
    var exif = ExifReader.ReadJpeg(stream);
}

Screenshots or Videos

スクリーンショット 2022-08-15 14 26 06

Configuration

dimonovdd commented 1 year ago

Try use MetadataExtractor. It works correctly for me.

telegram-cloud-photo-size-2-5201955108223565501-y

AceCoderLaura commented 9 months ago

I used MetadataExtractor as well as exiflibrary and neither can read any GPS data on the image returned by CapturePhotoAsync. I'm using Xamarin.MediaGallery 2.2.1

AceCoderLaura commented 9 months ago

For Android I added await Permissions.RequestAsync<Permissions.LocationWhenInUse>(); (Xamarin.Essentials) before calling CapturePhotoAsync and that fixed it for Android but iOS still doesn't return an image with GPS data.