[Image_Picker] fixed image orientation problem on Android#1878
[Image_Picker] fixed image orientation problem on Android#1878juliocbcotta wants to merge 3 commits intoflutter:masterfrom juliocbcotta:plugin/image_picker_image_rotation
Conversation
cyanglaz
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Ideally, this should be fixed from the framework. I do see your point to have it land sooner. However, I still need more time to verify if the changes are good especially for each transform.
I'm following the initial PR review policy, this PR isn't trivial to review so I'm labeling it with "backlog" and we will prioritize according to the issue's priority.
Relevant issue: flutter/flutter#35334
| @@ -0,0 +1,101 @@ | |||
| package io.flutter.plugins.imagepicker; | |||
There was a problem hiding this comment.
Can we keep the file name the same for this PR? Renaming the file keeps the diff hard to review in Github.
| matrix.setRotate(180); | ||
| break; | ||
| case ExifInterface.ORIENTATION_FLIP_VERTICAL: | ||
| matrix.setRotate(180); |
There was a problem hiding this comment.
shouldn't it just be matrix.setScale(1, -1) ?
|
The merge of this PR is not trivial. |
Description
This PR fixes (or tries to fix) orientation problems in the displayed images.
It uses the Exif information to normalize the image rotation so the image is always displayed correctly.
It will not solve all cases, as there are images without the correct Exif information, but will solve cases where the picture was taken with the phone up side down.
Related Issues
flutter/flutter#35334
Solving in the framework would be the best solution, but I think it may take some time to land if we wait the framework.
Breaking change
It will always create a new image file on Android. The current implementation sometimes creates an image file, that the developer already need to clear up after using the image if a resize was required. With the orientation fix we need a new file every time.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?