This is an automated email from the ASF dual-hosted git repository.

GitToTheHub pushed a commit to branch pr-fix-android-correctOrientation-for-PNG
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git

commit 2974814cfc7ddedbb9ea478a65d283ccd5ed996e
Author: Manuel Beck <[email protected]>
AuthorDate: Thu Aug 20 10:55:05 2026 +0200

    fix(android): correct EXIF orientation for non-JPEG camera captures
    
    - `MediaStore.ACTION_IMAGE_CAPTURE` always writes JPEG data into the 
capture file, regardless of the requested encodingType/file extension. Deriving 
the source mimeType from that file's extension
    (via `FileHelper.getMimeType`) caused PNG-named captures to be misreported 
as image/png, so `getScaledAndRotatedBitmap()` skipped reading the EXIF 
orientation and `correctOrientation` had no effect.
    - Use the actual JPEG mimeType for the captured source data instead, so 
orientation correction works regardless of the requested encodingType.
    
    Generated-By: Claude Sonnet 5
---
 src/android/CameraLauncher.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java
index ce6ca2e..27fb7dc 100644
--- a/src/android/CameraLauncher.java
+++ b/src/android/CameraLauncher.java
@@ -526,7 +526,11 @@ public class CameraLauncher extends CordovaPlugin 
implements MediaScannerConnect
         }
         else {
             input = 
cordova.getActivity().getContentResolver().openInputStream(imageUri);
-            mimeType = FileHelper.getMimeType(imageUri.toString(), cordova);
+            // MediaStore.ACTION_IMAGE_CAPTURE always writes JPEG data into 
imageUri, regardless of
+            // its file extension (which reflects the requested encodingType, 
not the actual format).
+            // Relying on FileHelper.getMimeType(imageUri) here would 
misreport PNG-named captures as
+            // image/png, causing getScaledAndRotatedBitmap() to skip reading 
the EXIF orientation.
+            mimeType = JPEG_MIME_TYPE;
         }
 
         if (input == null) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to