diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-10-30 10:40:58 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-10-30 10:40:58 +0100 |
commit | a7ba235e228d1b451c92dc6af5564d6a777229a5 (patch) | |
tree | d2cd40aabfffc49817ac86e4f5740bec0d8a0bc2 /src/imlib.c | |
parent | c6752c190fb54252d9f808e179bfee28f7bf3f0d (diff) | |
parent | f850bc191dbac45cdd3f39548b65a0f0e390bbb8 (diff) |
Merge branch 'teleshoes-autorotate'
Diffstat (limited to 'src/imlib.c')
-rw-r--r-- | src/imlib.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/imlib.c b/src/imlib.c index 16fbfba..193f5f8 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -259,19 +259,22 @@ int feh_load_image(Imlib_Image * im, feh_file * file) } #ifdef HAVE_LIBEXIF - file->ed = exif_get_data(file->filename); - - if (file->ed) { - entry = exif_content_get_entry(file->ed->ifd[EXIF_IFD_0], 0x0112); - if (entry != NULL) { - if (*(entry->data) == 3) - gib_imlib_image_orientate(*im, 2); - else if (*(entry->data) == 6) - gib_imlib_image_orientate(*im, 1); - else if (*(entry->data) == 8) - gib_imlib_image_orientate(*im, 3); - } + int orientation = 0; + ExifData *exifData = exif_data_new_from_file(file->filename); + if (exifData) { + ExifByteOrder byteOrder = exif_data_get_byte_order(exifData); + ExifEntry *exifEntry = exif_data_get_entry(exifData, EXIF_TAG_ORIENTATION); + if (exifEntry && opt.auto_rotate) + orientation = exif_get_short(exifEntry->data, byteOrder); } + file->ed = exifData; + + if (orientation == 3) + gib_imlib_image_orientate(*im, 2); + else if (orientation == 6) + gib_imlib_image_orientate(*im, 1); + else if (orientation == 8) + gib_imlib_image_orientate(*im, 3); #endif D(("Loaded ok\n")); |