I recently published RedCorners.ExifLibrary, a NuGet that lets you read and write EXIF metadata in image files. This is basically a fork of the ExifLibrary project by oozcitak, with four minor changes:
- It removes dependencies to System.Drawing, making the library work across all .net Standard 2.0 compatible runtimes, including Xamarin.iOS and Xamarin.Android.
- It adds a conversion helper method for going back and forth between floating point or Degrees/Minutes/Seconds representations for coordinates.
- It adds helper methods to quickly read and write GPS coordinates in the image files.
- Everything is moved to the RedCorners.ExifLibrary namespace, in order to make it possible to use both the original library and my version of it simultaneously.
- It has been tested on Xamarin.iOS, Xamarin.Android, .NET Core and .NET Framework on JPEG images.
You can get the NuGet from here: https://www.nuget.org/packages/RedCorners.ExifLibrary
Some quick examples:
using RedCorners.ExifLibrary; // Read GPS Coordinates var file = ImageFile.FromFile(Path); var coords = file.GetGPSCoords(); if (coords.HasValue) (Latitude, Longitude) = coords.Value; // Write GPS Coordinates var file = ImageFile.FromFile(Path); file.SetGPSCoords(Latitude, Longitude); file.Save(Path);
More information on GitHub.