繁体   English   中英

JPEG文件中的EXIF数据

[英]EXIF data in JPEG file

使用Android中的ExifInterface将自定义数据作为Exif data in a JPEG image file写入Exif data in a JPEG image file

想在JPEG file write/add自定义tags/exif数据,如姓名,年龄等...现在我可以编写默认值,如Geo location data, attributes etc...但我可以用JPEG编写自定义数据使用ExifInterface (Android)图像

这是否可能或任何其他替代方案,以保持图像的这些信息不足

Android的ExifInterface只允许您编写“已识别”的exif标记。 您可以在链接中找到一些公认的exif标记: http//developer.android.com/reference/android/media/ExifInterface.html

但好消息是,Android API中没有提到更多exif标签。 坏消息是,我还没有找到列出所有可用exif标签的库

经过几个小时的研究和实验,我发现以下标签有效:

“UserComment在”

因此,以下代码段将起作用:

String mString = "Your message here";     
ExifInterface exif = new ExifInterface(path_of_your_jpeg_file);
exif.setAttribute("UserComment", mString);
exif.saveAttributes();

我仍然试图找出允许哪些其他exif标签,但是现在,这应该可以解决问题。

为此,请使用Android EXIF界面

  1. 使用此方法添加属性public void setAttribute(String tag,String value)

  2. 使用此方法创建JPEG的新版本。 public void saveAttributes()

暂无
暂无

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

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