This is how I take the picture.
Location location = new Location();
location.Latitude = 52.0271723411551;
location.Longitude = 0.764563267810425;
photoFile = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
SaveToAlbum = true,
Location = location,
Directory = "Komunalac",
Name = "photoKomunalac.jpg",
SaveMetaData = true,
});
var picInfo = ExifLib.ExifReader.ReadJpeg(photoFile.GetStream());
imageSource = ImageSource.FromStream(() =>
{
return photoFile.GetStream();
});
And the picInfo does indeed hold the metadata with GPS location.
But then when I want to get the picture back from album using :
photoPicked = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions
{
PhotoSize = PhotoSize.Medium,
SaveMetaData = true
});
picInfo = null;
if (photoPicked != null)
{
picInfo = ExifReader.ReadJpeg(photoPicked.GetStream());
imageSource = ImageSource.FromStream(() =>
{
return photoPicked.GetStream();
});
}
picInfo here doesn't contain the GPS metadata. Anyone knows what went wrong or a different way to save the image with metadata to the android/ios?