From 691c6d7e7e7667696dcf5996316fba6a120f2e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Wed, 15 Feb 2012 19:13:44 +0100 Subject: Added own exif tag handling in files exif.[ch] --- image.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'image.c') diff --git a/image.c b/image.c index c9ffc59..6829dae 100644 --- a/image.c +++ b/image.c @@ -25,6 +25,7 @@ #include #include +#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); -- cgit v1.2.3