aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--image.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/image.c b/image.c
index 800321a..f8c6208 100644
--- a/image.c
+++ b/image.c
@@ -439,7 +439,11 @@ bool img_load(img_t *img, const fileinfo_t *file)
imlib_image_set_changes_on_disk();
-#if HAVE_LIBEXIF
+/* since v1.7.5, Imlib2 can parse exif orientation from jpeg files.
+ * this version also happens to be the first one which defines the
+ * IMLIB2_VERSION macro.
+ */
+#if HAVE_LIBEXIF && !defined(IMLIB2_VERSION)
exif_auto_orientate(file);
#endif
@@ -452,6 +456,10 @@ bool img_load(img_t *img, const fileinfo_t *file)
if (STREQ(fmt, "webp"))
img_load_webp(img, file);
#endif
+#if HAVE_LIBEXIF && defined(IMLIB2_VERSION)
+ if (!STREQ(fmt, "jpeg") && !STREQ(fmt, "jpg"))
+ exif_auto_orientate(file);
+#endif
}
img->w = imlib_image_get_width();
img->h = imlib_image_get_height();