Home

Awesome

UnicodeExifInterface

Introduction

In some case, we need write Unicode charset String to Exif's "UserComment" tag, but Android Jetpack's ExifInterface lib only support ASCII charset.

Base on Android Jetpack's ExifInterface lib, this lib support Unicode charset on "UserComment" tag.

Write "UserComment" :

Read "UserComment" :

Setup

  1. Add JitPack in your root build.gradle at the end of repositories:
allprojects {
    repositories {
      ...
      maven { url 'https://jitpack.io' }
    }
}
  1. Add this plugin library as a dependency in your app's build.gradle file:
dependencies {
    // please use Latest Version
    implementation 'com.github.ddyos:UnicodeExifInterface:1.2.1'
}
  1. Use. Similar to the Android Jetpack's ExifInterface lib:
try {
    //write
    UnicodeExifInterface unicodeExifInterface = new UnicodeExifInterface(getPhotoPath());
    unicodeExifInterface.setAttribute(UnicodeExifInterface.TAG_USER_COMMENT, "ýÄÑ123中文Englishにほんご");
    unicodeExifInterface.saveAttributes();
    //read
    UnicodeExifInterface unicodeExifInterface = new UnicodeExifInterface(getPhotoPath());
    String userComment = unicodeExifInterface.getAttribute(UnicodeExifInterface.TAG_USER_COMMENT);
} catch (Exception e) {
    e.printStackTrace();
}

License

Apache License 2.0, as found in the LICENSE file.