EXIF data in JPEG file

前端 未结 2 1825
一生所求
一生所求 2020-12-10 13:01

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

Would like to write/add custom tags

相关标签:
2条回答
  • 2020-12-10 13:11

    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

    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"

    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();
    

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

    0 讨论(0)
  • 2020-12-10 13:16

    To do this use the Android EXIF Interface

    1. Add your Attributes using this method public void setAttribute (String tag, String value)

    2. Make a new version of the JPEG with this method. public void saveAttributes ()

    0 讨论(0)
提交回复
热议问题