diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b3fcdf48e4..8365bfdf51 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -5688,7 +5688,7 @@ public class FragmentCompose extends FragmentBase { (!resize_width_only && options.outHeight / factor > resize)) factor *= 2; - Matrix rotation = ("image/jpeg".equals(attachment.type) ? ImageHelper.getImageRotation(file) : null); + Matrix rotation = ImageHelper.getImageRotation(attachment.type, file); Log.i("Image type=" + attachment.type + " factor=" + factor + " rotation=" + rotation); if (factor > 1 || rotation != null) { options.inJustDecodeBounds = false; diff --git a/app/src/main/java/eu/faircode/email/ImageHelper.java b/app/src/main/java/eu/faircode/email/ImageHelper.java index 238cbc4d4a..ea64d3ee6f 100644 --- a/app/src/main/java/eu/faircode/email/ImageHelper.java +++ b/app/src/main/java/eu/faircode/email/ImageHelper.java @@ -925,7 +925,7 @@ class ImageHelper { } if (bm != null) { - Matrix rotation = getImageRotation(file); + Matrix rotation = getImageRotation(mimeType, file); if (rotation != null) { Bitmap rotated = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), rotation, true); bm.recycle(); @@ -953,10 +953,11 @@ class ImageHelper { return drawable; } - static Matrix getImageRotation(File file) { + static Matrix getImageRotation(String mimeType, File file) { try { ExifInterface exif = new ExifInterface(file); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); + Log.i("Image Exif orientation=" + orientation + " type=" + mimeType); Matrix matrix = new Matrix(); switch (orientation) {