I am trying to get the orientation of an image (from gallery), but ExifInterface always returns 0. here is the code:
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
A bit late to the party, but I hope to help other developers struggling with this.
What helped me fix the issue was using:
android.support.media.ExifInterface
instead of
android.media.ExifInterface
It seems the ExifInterface from the support library does a better job at handling the various orientations. Please pay attention to the warnings the IDE gives. My warning was hiding inside a collapsed list of imports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With