Forum Xamarin.Android

How to add properties Location to image

huynhkhuynhk VNMember
edited August 2016 in Xamarin.Android

I tried to use ExifInterface to set Location of image like this:

    public void Save(Bitmap bitmap, string filePath, GpsLocation location)
                using(var stream = new MemoryStream())
                bitmap.Compress(Bitmap.CompressFormat.Jpeg, 50, stream);

                if (location.Longtitude != null)
                    ExifInterface newExif = new ExifInterface(filePath);
                    newExif.SetAttribute(ExifInterface.TagGpsLongitudeRef, location.Latitude);
                    newExif.SetAttribute(ExifInterface.TagGpsLongitudeRef, location.Longtitude);

                FileStorageHelper.WriteFile(filePath, Storage.External, stream.ToArray());

But it doesn't work, the image detail doesn't contain Location properties. Any ideas about this?

Best Answer


  • huynhkhuynhk VNMember

    It works for me, thanks @LasseMadsen

Sign In or Register to comment.