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.
+9 −1
1 file changed
- M image.c +9 −1
| @@ -439,7 +439,11 @@ bool img_load(img_t *img, const fileinfo_t *file) | |||
| 439 | 439 | ||
| 440 | 440 | imlib_image_set_changes_on_disk(); | |
| 441 | 441 | ||
| 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) | |
| 443 | 447 | exif_auto_orientate(file); | |
| 444 | 448 | #endif | |
| 445 | 449 | ||
| @@ -451,6 +455,10 @@ bool img_load(img_t *img, const fileinfo_t *file) | |||
| 451 | 455 | #if HAVE_LIBWEBP | |
| 452 | 456 | if (STREQ(fmt, "webp")) | |
| 453 | 457 | 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); | |
| 454 | 462 | #endif | |
| 455 | 463 | } | |
| 456 | 464 | img->w = imlib_image_get_width(); | |