Exif metadata does not give targeting to Google Drive Images

I am working with gallery / disk image display in my application using the Picasso library . The Samsung device captures all images in landscape mode, so it adds 90 degree rotation for portrait images.
These images are displayed correctly in Gallery, but the landscape is in my application.

// Let say photoUri is uri of google drive image
// i.e. photoUri = "content://com.google.android.apps.docs.storage/document/acc%3D3%3Bdoc%3D3223"
// photoUri.getPath = "/document/acc=3;doc=3209"

ExifInterface exif = new ExifInterface(photoUri.getPath());
int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
            ExifInterface.ORIENTATION_UNDEFINED);

      



But the value is rotation

always 0.

I faced the same issue even for an image captured from the Google Photos app.
In this case, I get

For image from Google Photos app,
photoUri = "content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Ffile%2F327/ORIGINAL/NONE/1460204671"
photoUri.getPath() = "/-1/1/content://media/external/file/327/ORIGINAL/NONE/1460204671"

      

My question is how to determine the orientation of the image uploaded to google drive or when selecting google photos.

+3


source to share





All Articles