SkillAgentSearch skills...

UnicodeExifInterface

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

Install / Use

/learn @ddyos/UnicodeExifInterface
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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" :

  • The string is converted to UTF-16 and saved with the Metadata's Byte Order.

Read "UserComment" :

  • For Unicode values, return an UTF-16 string.
  • Otherwise, return an ASCII String, just like Android Jetpack's ExifInterface lib.

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.

View on GitHub
GitHub Stars6
CategoryCustomer
Updated10mo ago
Forks3

Languages

Java

Security Score

77/100

Audited on May 11, 2025

No findings