[gthumb] fixed thumbnail generation for rotated images



commit 8888d906037b57add45ed3bc488c82fec36769ee
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Oct 21 12:32:55 2012 +0200

    fixed thumbnail generation for rotated images
    
    prefer the internal loader for jpeg images to load rotated images correctly.

 gthumb/gnome-desktop-thumbnail.c |    2 ++
 gthumb/gth-thumb-loader.c        |    9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gnome-desktop-thumbnail.c b/gthumb/gnome-desktop-thumbnail.c
index a927ee7..41552b5 100644
--- a/gthumb/gnome-desktop-thumbnail.c
+++ b/gthumb/gnome-desktop-thumbnail.c
@@ -1076,9 +1076,11 @@ gnome_desktop_thumbnail_factory_generate_no_script (GnomeDesktopThumbnailFactory
   if (pixbuf == NULL)
     pixbuf = gth_hook_invoke_get ("generate-thumbnail", (char *) uri, mime_type, size);
 
+#if 0
   /* ...lastly try the whole file */
   if (pixbuf == NULL)
     pixbuf = _gdk_pixbuf_new_from_uri_at_scale (uri, size, size, TRUE, FALSE, cancellable);
+#endif
 
   if (pixbuf == NULL)
     return NULL;
diff --git a/gthumb/gth-thumb-loader.c b/gthumb/gth-thumb-loader.c
index 0899fac..2123c11 100644
--- a/gthumb/gth-thumb-loader.c
+++ b/gthumb/gth-thumb-loader.c
@@ -172,9 +172,16 @@ generate_thumbnail (GInputStream  *istream,
 		g_object_unref (pixbuf);
 	}
 	else {
+		GthImageFormat     preferred_format;
 		GthImageLoaderFunc thumbnailer;
 
-		thumbnailer = gth_main_get_image_loader_func (mime_type, GTH_IMAGE_FORMAT_GDK_PIXBUF);
+		/* Prefer the internal loader for jpeg images to load rotated
+		 * images correctly. */
+		if (strcmp (mime_type, "image/jpeg") == 0)
+			preferred_format = GTH_IMAGE_FORMAT_CAIRO_SURFACE;
+		else
+			preferred_format = GTH_IMAGE_FORMAT_GDK_PIXBUF;
+		thumbnailer = gth_main_get_image_loader_func (mime_type, preferred_format);
 		if (thumbnailer != NULL)
 			image = thumbnailer (istream,
 					     file_data,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]