-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed EXIF orientation in MediaStoreRequestHandler #1459
base: master
Are you sure you want to change the base?
Conversation
… translate it to ExifInterface.ORIENTATION_* value. Picasso determines orientation according to ExifInterface.ORIENTATION_*. All possible values in MediaStore.Image.ORIENTATION are: 0, 90, 180, 270 (according to: https://developer.android.com/reference/android/provider/MediaStore.Images.ImageColumns.html#ORIENTATION). The values differ, thus orientation read from MediaStore must be translated to ExifInterface.ORIENTATION_* value. Updated RequestHandler::getExifOrientation description.
# Conflicts: # picasso/src/main/java/com/squareup/picasso/RequestHandler.java
…h ExifInterface. If file cannot be read use value provided by content resolver.
Is there any update on this? |
Updates are posted as comments to issues so if there's no new comments then On Thu, Oct 13, 2016 at 5:24 PM Chris Williams [email protected]
|
this fix doesn't seem to work, since |
return exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, | ||
ExifInterface.ORIENTATION_UNDEFINED); | ||
|
||
} catch (Exception ignored) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of catching and ignoring all exceptions, I think the proper way would be to retrieve the mime type of the image and only attempt to get orientation from exif metadata if the type supports exif (jpeg), otherwise return undefined.
return exifOrientation; | ||
} | ||
|
||
static int getExitOrientationFromFile(ContentResolver contentResolver, Uri uri) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exif*. I think it would be more clear to parse the file path and pass it in here instead of a uri. It seems incorrect to call this "getExifOrientationFromFile" and not pass a file.
May be too late, but
Those it can be only 0, 90, 180, 270. |
Merged changes from #1269 into this and fixed merge conflicts.
In my test even those changes do not fix orientation problems 100%, because at least on my phones orientation from content resolver do not always match actual EXIF in file. Therefore I've added reading EXIF directly from file. This data tends to be correct pretty much always.
I've left reading from content resolver as a fall-back if there is an exception when reading file.