简体   繁体   English

C#.Net无法从JPG图像读取一些EXIF数据

[英]C#.Net Fails to read some EXIF data from JPG Image

I have written simple module in C#.Net which reads image property (ie EXIF Data) and to do the same i have used below code: 我已经在C#.Net中编写了一个简单的模块,该模块读取图像属性(即EXIF数据),并执行以下代码:

Image ImgObject = new Bitmap("jpg image file path");

PropertyItem[] ImgObject = theImage.PropertyItems;

Collection of JPG images are captured from different Android devices (and explicitly added User Comments tag of EXIF data) - now C#.Net fails to read "User Comments" property. JPG图像的集合是从不同的Android设备捕获的(并显式添加了EXIF数据的用户注释标签)-现在C#.Net无法读取“用户注释”属性。 I have tried/checked using some other web based solution which reads "User Comments" field every time. 我已经尝试/检查过使用其他一些基于Web的解决方案,该解决方案每次都会读取“用户评论”字段。

Any pointer on this would be great help. 任何对此的指点都会有很大帮助。 Thank You. 谢谢。

Exif metadata is very flexible, and sometimes is even used for stegonography. Exif元数据非常灵活,有时甚至用于隐写术。 For getting user comments seem you have to work with bytes directly, reading everything before byte, indicating start of image, and then parsing it manually. 为了获得用户评论,您必须直接使用字节,读取字节之前的所有内容,指示图像的开始,然后手动对其进行解析。

For reading metadata from image files such as JPEG, try my MetadataExtractor library. 要从JPEG之类的图像文件中读取元数据,请尝试使用我的MetadataExtractor库。 It supports many image and video formats, and many types of embedded data such as Exif, IPTC, XMP and so forth. 它支持多种图像和视频格式,以及多种类型的嵌入式数据,例如Exif,IPTC,XMP等。

The API is very simple. 该API非常简单。 You can access a file's metadata with a single line of code. 您可以使用单行代码访问文件的元数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM