Skip to content
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

Fix openCamera reported dimensions for portrait photos on Android #2110

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Nov 25, 2024

We're observing width/height being incorrectly reported by the library on Android with portrait photos. This fix, similar to the logic here, is to swap the reported width/height if the EXIF tag specifies a rotated orientation.

This aligns with the library's behavior on iOS where the width/height are swapped for photos with rotated EXIF.

Test Plan

Verify that portrait photos (I was using Samsung Galaxy A12) report flipped dimensions, just like the iOS version does.

@@ -678,6 +679,15 @@ private WritableMap getImage(final Activity activity, String path) throws Except
throw new Exception("Cannot select remote files");
}
BitmapFactory.Options original = validateImage(path);
ExifInterface originalExif = new ExifInterface(path);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine to read just the original exif because the orientation tag gets carried forward in the compression step

@ivpusic ivpusic merged commit 174f609 into ivpusic:master Nov 26, 2024
@ivpusic
Copy link
Owner

ivpusic commented Nov 26, 2024

thanks!

@KasparovNikolay
Copy link

Hello, @ivpusic, tell me please, when a new version with this fix will be released?

@ivpusic
Copy link
Owner

ivpusic commented Nov 27, 2024

released in 0.41.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants