[gnome-desktop] gnome-bg: Handle EXIF orientations
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] gnome-bg: Handle EXIF orientations
- Date: Tue, 30 May 2017 16:37:14 +0000 (UTC)
commit d4fa2488aecfe0bedc5c495333ac82fbee8c8e45
Author: Silvère Latchurié <slatchurie gmail com>
Date: Tue May 30 18:18:33 2017 +0200
gnome-bg: Handle EXIF orientations
Apply the orientation of the images provided as metadata in the EXIF
tags when loading images for display as background images (such as
in gnome-control-center's Background panel).
https://bugzilla.gnome.org/show_bug.cgi?id=516177
libgnome-desktop/gnome-bg.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 749ff6a..82b2785 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -910,6 +910,14 @@ draw_once (GnomeBG *bg,
pixbuf = get_pixbuf_for_size (bg, num_monitor, rect.width, rect.height);
if (pixbuf) {
+ GdkPixbuf *rotated;
+
+ rotated = gdk_pixbuf_apply_embedded_orientation (pixbuf);
+ if (rotated != NULL) {
+ g_object_unref (pixbuf);
+ pixbuf = rotated;
+ }
+
draw_image_area (bg,
num_monitor,
pixbuf,
@@ -2554,8 +2562,17 @@ create_thumbnail_for_filename (GnomeDesktopThumbnailFactory *factory,
else {
orig = gdk_pixbuf_new_from_file (filename, NULL);
if (orig) {
- int orig_width = gdk_pixbuf_get_width (orig);
- int orig_height = gdk_pixbuf_get_height (orig);
+ int orig_width, orig_height;
+ GdkPixbuf *rotated;
+
+ rotated = gdk_pixbuf_apply_embedded_orientation (orig);
+ if (rotated != NULL) {
+ g_object_unref (orig);
+ orig = rotated;
+ }
+
+ orig_width = gdk_pixbuf_get_width (orig);
+ orig_height = gdk_pixbuf_get_height (orig);
result = pixbuf_scale_to_fit (orig, THUMBNAIL_SIZE, THUMBNAIL_SIZE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]