Android Create custom Exif attributes for image file

I'm currently trying to add a custom exif tag / data to the image file that is in the photo album.

I can modify existing tags defined in ExifInterfaceclass

However, I want to store user data, such as the user ID of my application, but it seems I can not create a custom exif attribute

the closest solution that I found is here , but does not work

+5
source share
2 answers

Try to save Exif data with a tag:

"UserComment"

the code:

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

, , ( String) . , exif, , . , .

+5

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
}
+1

All Articles