Compensate for incorrect camera orientation on affected iOS and Android devices#7326
Open
kaustuvpokharel wants to merge 4 commits into
Open
Compensate for incorrect camera orientation on affected iOS and Android devices#7326kaustuvpokharel wants to merge 4 commits into
kaustuvpokharel wants to merge 4 commits into
Conversation
Collaborator
🍎 MacOS DMG universal buildsDownload a MacOS DMG universal build of this PR for testing. 📱 Android buildsDownload an Android arm64 build of this PR for testing. Other Android architectures🪟 Windows buildsDownload a Windows build of this PR for testing and for arm64. (Built from commit 61481e1) 🐧 Linux AppImage buildsDownload a Linux AppImage build of this PR for testing. |
14b97cb to
b5132ab
Compare
bd417fc to
e9938d4
Compare
nirvn
reviewed
May 5, 2026
Member
|
@kaustuvpokharel , as per our discussion, can we narrow the code down to only apply to iOS and Windows OSes? I'll then send the iOS build to a local tester here to increase nb of devices tested. |
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.
On some iOS and Android devices, Qt Multimedia's produces wrong orientation when the device is held in landscape.
This PR introduces a CameraOrientationNormalizer object that lives inside the camera's capture loader and handles two things-
Preview correction: Computes a previewRotation value bound to VideoOutput.orientation. On iOS (where correctionAngle() returns 0, consistent with Qt's documentation noting the correction angle is non-zero mostly on Android), it applies 180° in landscape to compensate for the AVFoundation inversion
Captured image normalization: At shutter press, the current screen orientation is recorded. When the JPEG is saved, normalizeImageOrientation() compares the pixel dimensions against the recorded orientation, if the user captured in landscape but the pixels are portrait (or vice versa), it rotates them. Any non-identity EXIF tag is stripped by re-saving with EXIF reset to identity. If everything already matches, the file is not touched. The corrected image is then shown as the photo preview, so the user sees the right orientation before accepting.
On devices where the backend already produces correct output, previewRotation is 0 in portrait (no change) and the image normalization returns false without modifying the file, should not regression.
THIS NEEDS TESTING ON FEW DEVICES