JPEG文件中的EXIF数据 [英] EXIF data in JPEG file
问题描述
在Android图片中使用 ExifInterface
将自定义数据作为 Exif数据写入JPEG图像文件
Write custom data as a Exif data in a JPEG image file
using ExifInterface
in Android
希望在<$中写入/添加
自定义 tags / exif
数据c $ c> JPEG文件如姓名,年龄等...现在我能够写出默认值,如地理位置数据,属性等...
但是我可以使用在JPEG图像中编写自定义数据ExifInterface(Android)
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标记: 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"
因此,以下代码段将起作用:
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文件中的EXIF数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!