Mercurial > geeqie.yaz
diff src/thumb_standard.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_standard.c Sun Jun 15 20:09:15 2008 +0000 +++ b/src/thumb_standard.c Sun Jun 15 21:52:15 2008 +0000 @@ -20,6 +20,7 @@ #include "pixbuf_util.h" #include "ui_fileops.h" #include "filedata.h" +#include "exif.h" /* @@ -398,8 +399,27 @@ { GdkPixbuf *pixbuf_thumb = NULL; GdkPixbuf *result; + GdkPixbuf *rotated = NULL; gint sw, sh; + + 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; + } + sw = gdk_pixbuf_get_width(pixbuf); sh = gdk_pixbuf_get_height(pixbuf); @@ -484,6 +504,7 @@ } if (pixbuf_thumb) g_object_unref(pixbuf_thumb); + if (rotated) g_object_unref(rotated); return result; }