Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to save the metadata of the image taken and saved (using jamesmontemagno/MediaPlugin)?

$
0
0

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?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>