summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@gmx.com>2012-02-15 19:13:44 +0100
committerBert Münnich <ber.t@gmx.com>2012-02-15 19:13:44 +0100
commit691c6d7e7e7667696dcf5996316fba6a120f2e7b (patch)
tree9f15fc97b55a8536d24fce3aad1646a05d686fb2 /image.c
parentb752d5c594d5aac083cc563e8c7e575baf7b8edc (diff)
downloadnsxiv-691c6d7e7e7667696dcf5996316fba6a120f2e7b.tar.zst
Added own exif tag handling in files exif.[ch]
Diffstat (limited to 'image.c')
-rw-r--r--image.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/image.c b/image.c
index c9ffc59..6829dae 100644
--- a/image.c
+++ b/image.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <gif_lib.h>
+#include "exif.h"
#include "image.h"
#include "options.h"
#include "util.h"
@@ -64,6 +65,34 @@ void img_init(img_t *img, win_t *win) {
img->multi.animate = false;
}
+void exif_auto_orientate(const fileinfo_t *file) {
+ switch (exif_orientation(file)) {
+ case 5:
+ imlib_image_orientate(1);
+ case 2:
+ imlib_image_flip_vertical();
+ break;
+
+ case 3:
+ imlib_image_orientate(2);
+ break;
+
+ case 7:
+ imlib_image_orientate(1);
+ case 4:
+ imlib_image_flip_horizontal();
+ break;
+
+ case 6:
+ imlib_image_orientate(1);
+ break;
+
+ case 8:
+ imlib_image_orientate(3);
+ break;
+ }
+}
+
bool img_load_gif(img_t *img, const fileinfo_t *file) {
GifFileType *gif;
GifRowType *rows = NULL;
@@ -254,6 +283,8 @@ bool img_load(img_t *img, const fileinfo_t *file) {
warn("could not open image: %s", file->name);
return false;
}
+ if (STREQ(fmt, "jpeg"))
+ exif_auto_orientate(file);
if (STREQ(fmt, "gif"))
img_load_gif(img, file);