fix: photo orientation#1915
Closed
cimigree wants to merge 6 commits into
Closed
Conversation
Contributor
|
closing as we are descoping until we switch to the new architecture |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
towards #1872
Turns out we cannot update to
react-native-vision-cameraversion 5 without the new architecture. This is not well documented and took me a while to figure out.So this fix is attempting to override whatever EXIF orientation vision camera wrote (correct or not) with this command:
await Exify.write(raw.uri, {Orientation: 1};Then after that we apply our home grown rotation using the accelerometer.
The
manipulateAsyncAPI got deprecated so now I made a wrapper/ helper for the suggested replacement (ImageManipulator.manipulate) since we use that behavior 3 times.Also, in order to display the photo in the correct orientation, we have to calculate the layout using the accelerometer data
At this point, this fix works for my three devices (two Samsungs and a Pixel running Android 15 & 16) but not for a Motorola (Moto G4) testing device running Android 14.
It would be helpful to know why, so an idea is to see what the Exif value is for four different scenarios (portrait upright, landscape right, portrait upside down, landscape left). Then we can ascertain if possibly vision camera is writing wrong EXIF on that device. If not, we are stuck and have to wait for upgrade to vision camera 5.
I have added temporary Sentry logging in case we want to debug this further so that we can see what the Exif Orientation is for a tester since different devices could possibly be using different values.
We could do an apk build and check Sentry for the Motorola to see what might be going on..