From b057613bac81a799ac977a1290f506e9a301b46b Mon Sep 17 00:00:00 2001 From: Ole-Morten Duesund Date: Mon, 11 May 2026 16:59:28 +0200 Subject: [PATCH] Write the user's physical tilt into the saved photo's EXIF orientation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Capture saves the bitmap in the device's portrait frame (CameraX rotates the sensor 90° to match the locked-portrait activity), so a photo taken while the phone was held in landscape lands on disk as a portrait-shaped bitmap with world-up pointing to the side. Tag the EXIF orientation with the user's actual tilt at shutter time (OrientationEventListener-derived deviceRotation, which up to now was passed in but ignored), so gallery viewers rotate the photo to match how the phone was held. Bump to 1.1.15. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../no/naiv/tiltshift/camera/ImageCaptureHandler.kt | 12 +++++++++++- version.properties | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/no/naiv/tiltshift/camera/ImageCaptureHandler.kt b/app/src/main/java/no/naiv/tiltshift/camera/ImageCaptureHandler.kt index b0401e7..b93db9a 100644 --- a/app/src/main/java/no/naiv/tiltshift/camera/ImageCaptureHandler.kt +++ b/app/src/main/java/no/naiv/tiltshift/camera/ImageCaptureHandler.kt @@ -24,6 +24,7 @@ import kotlin.coroutines.resume import kotlin.math.cos import kotlin.math.sin import kotlin.math.sqrt +import no.naiv.tiltshift.util.OrientationDetector /** * Handles capturing photos with the tilt-shift effect applied. @@ -121,10 +122,19 @@ class ImageCaptureHandler( var thumbnail: Bitmap? = null try { thumbnail = createThumbnail(captureResult.processed) + // Camera bitmap is in the device's portrait frame (CameraX + // rotated the sensor 90° because the activity is locked to + // portrait). Tag the EXIF with the user's physical tilt + // when they pressed the shutter so viewers display the + // photo right-side-up regardless of how the phone was held. + val exifOrientation = OrientationDetector.degreesToExifOrientation( + OrientationDetector.rotationToDegrees(deviceRotation), + isFrontCamera + ) val result = photoSaver.saveBitmapPair( original = captureResult.original, processed = captureResult.processed, - orientation = ExifInterface.ORIENTATION_NORMAL, + orientation = exifOrientation, location = location ) if (result is SaveResult.Success) { diff --git a/version.properties b/version.properties index f37cebb..214906f 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ versionMajor=1 versionMinor=1 -versionPatch=14 -versionCode=16 +versionPatch=15 +versionCode=17