我写了一个应用程序,通过.Net的System.Drawing.Image类中公开的PropertyItems读取图像的基本EXIF数据。然而,我无法通过这些属性检索到佳能特定的EXIF数据。如何读取这些信息?我知道它存在于文件中,因为Photoshop可以读取它。
我之前发现了这个工具,但还没有使用过。看起来它有制造商特定的信息。
http://renaud91.free.fr/MetaDataExtractor/
更新:
自2002年以来,metadata-extractor项目一直在Java上运行良好,并且现在也可用于.NET。它全面支持佳能、爱克发、卡西欧、爱普生、富士、柯达、京瓷、徕卡、美能达、尼康、奥林巴斯、松下、宾得、三洋、Sigma/Foveon和索尼相机和扫描仪的makernote。
您可以在此处浏览几个佳能(和其他)相机图像的示例输出。
该库可通过NuGet或GitHub获取。
示例用法:
IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(path);
foreach (var directory in directories)
foreach (var tag in directory.Tags)
{
Console.Out.WriteLine($"{directory.Name} - {tag.TagName} = {tag.Description}");
}
在此查看更新的答案:C#检索佳能特定的EXIF数据
IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(path);
foreach (var directory in directories)
foreach (var tag in directory.Tags)
{
Console.Out.WriteLine($"{directory.Name} - {tag.TagName} = {tag.Description}");
}
BitmapSource
类 加载图像,该类通过 Metadata
属性 公开 EXIF 元数据。这将更加接近图片中的 EXIF 信息,尽管制造商注释是具体的,需要进一步解码。我几个月前在C#中编写了一个取证工具,并使用Phil Harvey的EXIF Tool从照片中获取EXIF数据。是的,它是一个PERL库,但是非常容易安装并集成到我的C#应用程序中。