Skip to content

fix(iPad): correct photo rotation in landscape mode #6086 #6089

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mxzmr
Copy link

@mxzmr mxzmr commented Jul 31, 2025

Resolves #6086

Problem:
On iPadOS, in landscape mode, when taking a picture, the camera image is rotated 90° to the right. If you hold the iPad in portrait mode, the camera orientation is correct.

Expected behavior:
The camera feed and captured photo orientation should match the physical orientation of the device.

Solution:

CameraCaptureSession

  • Introduced setCaptureOrientation(_:), a safe helper that updates captureOrientation and the AVCaptureConnection on the dedicated session queue.

PhotoCaptureViewController
In viewWillAppear we now:

  • Obtain the current UIWindowScene.interfaceOrientation (iPad-only).
  • Update the preview layer via the existing updateVideoPreviewConnection(to:).
  • Call the new setCaptureOrientation so the encoder receives the same orientation.

Testing:

  • iPad 9″ (iOS 18.3.2):

    • Portrait: Preview and captured photo orientation correct.
    • Landscape: Preview and captured photo orientation correct.
  • iPhone 16 pro max (iOS 18.5):

    • Verified no regressions, camera functionality remains correct in both portrait and landscape.

Contributor checklist

  • My commits are rebased on the latest main branch
  • My commits are in nice logical chunks
  • My contribution is fully baked and is ready to be merged as is
  • I have tested my contribution on these devices:
  • iPad 9, iOS 18.3.2
  • iPhone 16 pro max, iOS 18.5

- Added CameraCaptureSession.setCaptureOrientation(_:) to let callers
update the underlying capture orientation on the session queue.
- In PhotoCaptureViewController.viewWillAppear(_:), derive the correct
  interface orientation on iPad and invoke the new helper, keeping the
  preview layer and capture pipeline in sync.

Photos and videos captured while the iPad is held in landscape now embed
the correct EXIF / track orientation; no more 90-degree rotation to portrait.
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.

Wrong camera orientation when taking picture on iPad in landscape
1 participant