From 555403f4305eeda83bcd45fc4bd20670e5eac9da Mon Sep 17 00:00:00 2001 From: Yaron Budowski Date: Mon, 23 Sep 2024 15:05:01 +0200 Subject: [PATCH] #1363 - fix rotation issues in certain cases introduced by #1293 --- .../src/main/java/org/inaturalist/android/ImageUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iNaturalist/src/main/java/org/inaturalist/android/ImageUtils.java b/iNaturalist/src/main/java/org/inaturalist/android/ImageUtils.java index be49b5f4..3454e45c 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/ImageUtils.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/ImageUtils.java @@ -398,7 +398,7 @@ public static String resizeImage(Context context, String path, Uri photoUri, int int rotationDegrees = 0; - if (path != null) { + if (path != null && path.toLowerCase().endsWith("heic")) { androidx.exifinterface.media.ExifInterface exif = new androidx.exifinterface.media.ExifInterface(path); rotationDegrees = exif.getRotationDegrees(); } @@ -466,7 +466,7 @@ public static String resizeImage(Context context, String path, Uri photoUri, int Logger.tag(TAG).debug(String.format("resizeImage: %s => %s", path, imageFile.getAbsolutePath())); resizedBitmap.recycle(); - rotatedBitmap.recycle(); + if (resizedBitmap != rotatedBitmap) rotatedBitmap.recycle(); // BitmapFactory.decodeStream moves the reading cursor is.close();