Exif metadata does not give orientation for Google drive images

时间:2017-07-12 08:08:35

标签: android image orientation picasso exif

I am working with displaying gallery/drive images in my app using Picasso library. Samsung device captures all images in landscape mode, so that it added 90 degree rotation for portrait images.
These images are displayed properly in Gallery but landscape in my app.

// Let's 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 rotation value is always 0.

I am facing the same issue even for image picked up from Google Photos app.
In that case I am getting

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 identify orientation for image uploaded in Google drive or while picking from Google photos.

0 个答案:

没有答案