summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-09-06 11:09:57 +0200
committerBert <ber.t@gmx.com>2011-09-08 15:57:44 +0200
commitbfab4dc328f580cc21c31ee3e4f53e1b8ca7c4ab (patch)
tree12c7c9a2538551f98b1712903c7408ecb2d7fd3b /thumbs.c
parentb96c10633782d697a4f5573099b0762630b45347 (diff)
downloadnsxiv-bfab4dc328f580cc21c31ee3e4f53e1b8ca7c4ab.tar.zst
Added EXIF auto-orientation
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/thumbs.c b/thumbs.c
index 5708651..cede997 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -34,6 +34,8 @@
#define st_atim st_atimespec
#endif
+void exif_auto_orientate(const fileinfo_t*);
+
const int thumb_dim = THUMB_SIZE + 10;
char *cache_dir = NULL;
@@ -221,6 +223,7 @@ int tns_load(tns_t *tns, int n, const fileinfo_t *file,
float z, zw, zh;
thumb_t *t;
Imlib_Image *im;
+ const char *fmt;
if (!tns || !tns->thumbs || !file || !file->name || !file->path)
return 0;
@@ -252,6 +255,12 @@ int tns_load(tns_t *tns, int n, const fileinfo_t *file,
imlib_context_set_image(im);
imlib_context_set_anti_alias(1);
+ if (!cache_hit) {
+ fmt = imlib_image_format();
+ if (!strcmp(fmt, "jpeg"))
+ exif_auto_orientate(file);
+ }
+
w = imlib_image_get_width();
h = imlib_image_get_height();
zw = (float) THUMB_SIZE / (float) w;