EXIF lat / long来自Unity中的图像

时间:2016-11-23 15:40:04

标签: c# unity3d exif

我需要一个c#脚本来统一,可以读取照片中的EXIF lat / long数据。我想在那个位置放置一个posTransform。不确定Unity中是否可以这样做。我想将我的图像加载到一起,并有一个脚本读取EXIF:1-GPS纬度/长,2个旋转,3个时间戳从照片。我还没有找到任何信息说这可以在团结中完成,但是,我已经读过exiflib github项目以及其他不统一的方式。

提前感谢您的帮助

1 个答案:

答案 0 :(得分:2)

我维护了一个项目,用于从图像中提取元数据,为您提供所需的内容。

https://github.com/drewnoakes/metadata-extractor-dotnet

该库支持.NET 3.5,因此应该在Unity下工作,尽管我之前没有测试过。

有了它,你会写:

var directories = ImageMetadataReader.ReadMetadata(filePath);
var gpsDirectory = directories.OfType<GpsDirectory>().FirstOrDefault();
if (gpsDirectory != null)
{
    var location = gpsDirectory.GetGeoLocation();

    Console.WriteLine($"Photo was taken at {location.Latitude},{location.Longitude}");
}