Mercurial > geeqie
diff src/thumb.c @ 839:14520c3a91f8
rotate thumbnails by exif
author | nadvornik |
---|---|
date | Sun, 15 Jun 2008 21:52:15 +0000 |
parents | 9bd49e725ad3 |
children | 64ef209bcded |
line wrap: on
line diff
--- a/src/thumb.c Sun Jun 15 20:09:15 2008 +0000 +++ b/src/thumb.c Sun Jun 15 21:52:15 2008 +0000 @@ -20,6 +20,7 @@ #include "pixbuf_util.h" #include "thumb_standard.h" #include "ui_fileops.h" +#include "exif.h" #include <utime.h> @@ -147,6 +148,7 @@ GdkPixbuf *pixbuf; gint pw, ph; gint save; + GdkPixbuf *rotated = NULL; DEBUG_1("thumb done: %s", tl->fd->path); @@ -158,6 +160,24 @@ return; } + + if (!tl->cache_hit && options->image.exif_rotate_enable) + { + if (!tl->fd->exif_orientation) + { + ExifData *exif = exif_read_fd(tl->fd); + gint orientation; + + if (exif && exif_get_integer(exif, "Exif.Image.Orientation", &orientation)) + tl->fd->exif_orientation = orientation; + else + tl->fd->exif_orientation = 1; + } + + rotated = pixbuf_apply_orientation(pixbuf, tl->fd->exif_orientation); + pixbuf = rotated; + } + pw = gdk_pixbuf_get_width(pixbuf); ph = gdk_pixbuf_get_height(pixbuf); @@ -217,6 +237,8 @@ save = il->shrunk; } + if (rotated) gdk_pixbuf_unref(rotated); + /* save it ? */ if (tl->cache_enable && save) {