2013-03-19 133 views

回答

5

尝试与标签保存Exif数据:

“UserComment在”

代码:

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

你可以把你在那里想要的东西(如字符串),并简单地分析字符串。我希望我们能够创建和命名我们自己的exif标签,但事实是我们不能。所以这是我想出的最佳解决方案。

+0

我试图与ObjExifInterface.setAttribute( “UserComment在”,指出: “......”);但它不起作用。 – 2013-09-23 10:42:09

1

保存与标签Exif数据"ImageDescription"

https://developer.android.com/reference/android/media/ExifInterface.html

代码

try { 
    String imageDescription = "Your image description";  
    ExifInterface exif = new ExifInterface(file_name_of_jpeg); 
    exif.setAttribute("ImageDescription", imageDescription); 
    exif.saveAttributes(); 
} catch (IOException e) { 
    // handle the error 
}