1. 从NuGet包管理器安装MetadataExtractor库
工具-NuGet包管理器-管理解决方案的NuGet程序包,搜索MetadataExtractor库,并安装。
2. C#读取照片元数据信息
using System.IO;
using MetadataExtractor;
using MetadataExtractor.Formats.Exif;
DirectoryInfo directoryInfo = new DirectoryInfo(Path);
FileInfo [] files = directoryInfo.GetFiles();
foreach (FileInfo file in files)
{
if (file.Extension == ".*" )
{
var metaDirectories = ImageMetadataReader.ReadMetadata(Path + "\\" + file.Name);
foreach (var directory in metaDirectories)
{
foreach (var tag in directory.Tags)
{
//to do
}
}
}
}
3. 引用
https://github.com/drewnoakes/metadata-extractor-dotnet
版权声明:本文为Fannies原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。