EXIF data in JPEG file
Solution 1
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.
Solution 2
To do this use the Android EXIF Interface
Add your Attributes using this method public void setAttribute (String tag, String value)
Make a new version of the JPEG with this method. public void saveAttributes ()
Related videos on Youtube
Ankit Shah
Updated on June 04, 2022Comments
-
Ankit Shah almost 2 years
Write custom data as a
Exif data in a JPEG image file
usingExifInterface
in AndroidWould like to
write/add
customtags/exif
data inJPEG file
like name, age, etc... Right now i am able to write default values likeGeo location data, attributes etc...
but can i write custom data in JPEG image usingExifInterface (Android)
Is this possible or any other alternative to maintain these short of information with image
-
Aram about 12 yearsHi. I have tried to write custom data using ExifInterface, but it's won't to write it, so I have looked at source codes of this class. It's uses a native class, I have looked that class to, and found, that it's impossible. If you have found the solution of this problem, please add the answer.
-
-
EsmaeelQash almost 8 yearsafter I added "UserComment", the Image Disappear from the gallery!! - does somebody face this problem?
-
sups over 5 years@ baekacaek after writing custom attribute how to re read it? any idea?