如何使用C#从一个文件中的EXIF数据 [英] How to get the EXIF data from a file using C#

查看:285
本文介绍了如何使用C#从一个文件中的EXIF数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想C#编写的小程序,经过我的JPEG照片,例如,他们将排序日期的文件夹(使用我约会的约定,该死......)。

I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...).

有谁知道一个相对简单的方式来获得的EXIF数据,如日期和时间或曝光编程?
谢谢!

Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programatically? Thanks!

推荐答案

的建议,你可以使用一些第三方库,或做手工(这是不是这么多的工作),但最简单,最灵活的方式是也许在.NET中使用的内置功能。更多请见:

As suggested, you can use some 3rd party library, or do it manually (which is not that much work), but the simplest and the most flexible is to perhaps use the built-in functionality in .NET. For more see:


  • <一个href=\"http://msdn.microsoft.com/en-us/library/system.drawing.image.propertyitems.aspx\">System.Drawing.Image.PropertyItems地产

<一个href=\"http://msdn.microsoft.com/en-us/library/system.drawing.imaging.propertyitem.aspx\">System.Drawing.Imaging.PropertyItem类

如何:读取图像元数据

我说:这是最灵活的,因为.NET不会尝试跨$ P $磅或以任何方式合并数据。对于每个EXIF你基本上得到一个字节数组。这可能是好还是坏取决于你实际有多少控制想要的。

I say "it’s the most flexible" because .NET does not try to interpret or coalesce the data in any way. For each EXIF you basically get an array of bytes. This may be good or bad depending on how much control you actually want.

另外,我要指出的是财产清单实际上并不直接对应于EXIF​​值。 EXIF本身存储在多个表重叠的ID,但.NET放入一个列表一切和重新定义的某些项目的ID。但只要你不关心precise EXIF​​的ID,你应该罚款与.NET映射。

Also, I should point out that the property list does not in fact directly correspond to the EXIF values. EXIF itself is stored in multiple tables with overlapping ID’s, but .NET puts everything in one list and redefines ID’s of some items. But as long as you don’t care about the precise EXIF ID’s, you should be fine with the .NET mapping.

这篇关于如何使用C#从一个文件中的EXIF数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆