Muhammad Umair
Muhammad Umair

Reputation: 593

ExifInterface returns image orientation 0

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

Upvotes: 3

Views: 602

Answers (1)

BitParser
BitParser

Reputation: 3968

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.

Upvotes: 1

Related Questions