码迷,mamicode.com
首页 > 其他好文 > 详细

使用ExifInterface设置Datetime发生的问题

时间:2014-12-20 20:53:21      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:

最近在弄一个Android小程序,需要把图像的生成时间设置到Exif的Datetime,用ExifInterface.setAttribute(ExifInterface.TAG_DATETIME,"2014/12/12 12:12:12")这种设置方式没有用,程序执行没有任何错误,也没有任何作用,设置不成功,到AndroidAPI的官网查也没有任何说明。

只能求助于Google老师(幸亏在海外,还能查),最终找到了这篇文章。http://www.media.mit.edu/pia/Research/deepview/exif.html,关于Exif的格式有明确的记载,其中关于Datetime有如下说明,

0x0132 DateTime  ascii string 20  Date/Time of image was last modified. Data format is "YYYY:MM:DD HH:MM:SS"+0x00, total 20bytes. In usual, it has the same value of DateTimeOriginal(0x9003)

也就是说,DateTime必须设置成“YYYY:MM:DD HH:MM:SS”的样式。

这样刚才执行没有任何作用的程序修改成:ExifInterface.setAttribute(ExifInterface.TAG_DATETIME,"2014:12:12 12:12:12")就可以把时间信息存入图像的Exif信息了。

关于Exif信息的由来,可以参照如下文章:

http://zh.wikipedia.org/wiki/EXIF

使用ExifInterface设置Datetime发生的问题

标签:

原文地址:http://www.cnblogs.com/WestContinent/p/4175802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!