在JPEG文件的Andr​​oid的Exif数据 [英] Android Exif data in JPEG file

查看:142
本文介绍了在JPEG文件的Andr​​oid的Exif数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写自定义的数据作为的JP​​EG图像文件使用Exif数据中 ExifInterface 中的Andr​​oid

Write custom data as a Exif data in a JPEG image file using ExifInterface in Android

写/在 JPEG文件添加自定义标记/ EXIF​​ 数据如姓名,年龄,等等......现在我能写出像地理定位数据,属性等等... ,但我可以利用写在JPEG图像定制数据 ExifInterface(安卓)

Would like to write/add custom tags/exif data in JPEG file like name, age, etc... Right now i am able to write default values like Geo location data, attributes etc... but can i write custom data in JPEG image using ExifInterface (Android)

这是可能的或任何其他的替代,以保持这些短的图像信息

Is this possible or any other alternative to maintain these short of information with image

推荐答案

Android的ExifInterface只允许你写的EXIF标签的认可。你可以找到一些公认的EXIF标签中的链接:<一href="http://developer.android.com/reference/android/media/ExifInterface.html">http://developer.android.com/reference/android/media/ExifInterface.html

Android's ExifInterface only lets you write exif tags that are "recognized." You can find SOME of the recognized exif tags in the link: http://developer.android.com/reference/android/media/ExifInterface.html

但值得庆幸的是,有这不是Android的API中提到的更多的EXIF标签。 坏消息是,我还没有找到一个库,它列出了所有可用的EXIF标签

But the good news is, there's more exif tags that's not mentioned in the Android API. Bad news is, I still haven't found a library that lists all usable exif tags

研究和试验了几个小时后,我发现了以下标签的作品:

After researching and experimenting for hours, I found that the following tag works:

UserComment在

"UserComment"

所以下面code段将工作:

So the following code snippet will work:

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

我仍然试图找出其他的EXIF标签是允许它,但现在,这应该做的伎俩。

I'm still trying to find out which other exif tags are allowed, but for now, this should do the trick.

这篇关于在JPEG文件的Andr​​oid的Exif数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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