Krolyxon
Commit e839638

Branches

Refs →

nsxive839638

fix: jpeg exif orientation on Imlib2 v1.7.5 (#188)

since Imlib2 v1.7.5, it is capable of parsing exif data on jpeg files
and auto orienting them. this caused nsxiv to rotate the image twice.
Author
N-R-K
Date
2022-01-02 02:28 +0600
Committer
GitHub · 2022-01-02 02:28 +0600
Parent
e777adf
Commit
e839638156b5d2443fed1ce49786c2788f6205aa

+9 −1

1 file changed

  1. M image.c +9 −1
M image.c View
@@ -439,7 +439,11 @@ bool img_load(img_t *img, const fileinfo_t *file)
439439
440440 imlib_image_set_changes_on_disk();
441441
442−#if HAVE_LIBEXIF
442+/* since v1.7.5, Imlib2 can parse exif orientation from jpeg files.
443+ * this version also happens to be the first one which defines the
444+ * IMLIB2_VERSION macro.
445+ */
446+#if HAVE_LIBEXIF && !defined(IMLIB2_VERSION)
443447 exif_auto_orientate(file);
444448 #endif
445449
@@ -451,6 +455,10 @@ bool img_load(img_t *img, const fileinfo_t *file)
451455 #if HAVE_LIBWEBP
452456 if (STREQ(fmt, "webp"))
453457 img_load_webp(img, file);
458+#endif
459+#if HAVE_LIBEXIF && defined(IMLIB2_VERSION)
460+ if (!STREQ(fmt, "jpeg") && !STREQ(fmt, "jpg"))
461+ exif_auto_orientate(file);
454462 #endif
455463 }
456464 img->w = imlib_image_get_width();