[英]Why can't i retrieve EXIF properties from an image?
我有一个带有某些属性的图像,可以在资源管理器的属性对话框中看到该图像:
但是当我尝试使用MSDN 此处列出的属性信息检索它们时
var propItem = image.GetPropertyItem(0x010F); // PropertyTagEquipMake = 0x010F
var equipmentMake = Encoding.ASCII.GetString(propItem.Value);
propItem = image.GetPropertyItem(0x0110); // PropertyTagEquipModel = 0x0110
var equipmentModel = Encoding.ASCII.GetString(propItem.Value);
通常,我会同时获得两个值,但是对于某些文件,我会获得补偿,但是对于模型的搜索返回了ArgumentException
属性。
像这样遍历图像上的属性:
foreach (var prop in image.PropertyItems)
{
Console.WriteLine("{0}\t:\t{1}\t:\t{2}\t:\t{3}", prop.Id, prop.Len, prop.Type, Encoding.UTF8.GetString(prop.Value));
}
(基于此文章)
显示出我的图像中确实缺少模型属性。
是什么赋予了? 元数据是否以我应该寻找的其他格式存储?
可能是此文件中的相机型号未存储为exif,而是存储为xmp或特定相机标签等其他标签。 例如,您可以在http://regex.info/exif.cgi上进行检查。
在这种情况下,我可以向Phil Harvey( http://www.sno.phy.queensu.ca/~phil/exiftool/ )推荐出色的ExifTool。
您可以尝试使用MetadataExtractor库。 它支持许多不同类型的元数据(Exif,IPTC,JFIF,XMP ...)以及几种图像和视频格式。
在NuGet上可用。
如果可以共享您的图像,我可以根据需要帮助进一步诊断此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.