Index: libgnomeui/gnome-vfs-util.c
===================================================================
--- libgnomeui/gnome-vfs-util.c	(revision 5298)
+++ libgnomeui/gnome-vfs-util.c	(working copy)
@@ -60,6 +60,8 @@ struct GnomeGdkPixbufAsyncHandle {
 typedef struct {
     gint width;
     gint height;
+    gint input_width;
+    gint input_height;
     gboolean preserve_aspect_ratio;
 } SizePrepareContext;
 
@@ -104,6 +106,9 @@ size_prepared_cb (GdkPixbufLoader *loade
 
 	g_return_if_fail (width > 0 && height > 0);
 
+	info->input_width = width;
+	info->input_height = height;
+	
 	if (width < info->width && height < info->height) return;
 	
 	if (info->preserve_aspect_ratio && 
@@ -170,6 +175,7 @@ gnome_gdk_pixbuf_new_from_uri_at_scale (
     GdkPixbufAnimationIter *iter;
     gboolean has_frame;
     SizePrepareContext info;
+    gchar in_width[16], in_height[16];
 
     g_return_val_if_fail (uri != NULL, NULL);
 
@@ -184,6 +190,7 @@ gnome_gdk_pixbuf_new_from_uri_at_scale (
     if (1 <= width || 1 <= height) {
         info.width = width;
         info.height = height;
+	info.input_width = info.input_height = 0;
         info.preserve_aspect_ratio = preserve_aspect_ratio;        
         g_signal_connect (loader, "size-prepared", G_CALLBACK (size_prepared_cb), &info);
     }
@@ -235,6 +242,15 @@ gnome_gdk_pixbuf_new_from_uri_at_scale (
     }
     g_object_unref (G_OBJECT (loader));
 
+    if (info.input_width > 0) {
+	sprintf (in_width, "%d", info.input_width);
+	gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Width", in_width);
+    }
+    if (info.input_height > 0) {
+	sprintf (in_height, "%d", info.input_height);
+	gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Height", in_height);
+    }
+    
     return pixbuf;
 }
 
Index: libgnomeui/gnome-thumbnail-pixbuf-utils.c
===================================================================
--- libgnomeui/gnome-thumbnail-pixbuf-utils.c	(revision 5298)
+++ libgnomeui/gnome-thumbnail-pixbuf-utils.c	(working copy)
@@ -350,6 +350,7 @@ _gnome_thumbnail_load_scaled_jpeg (const
 				   int         target_width,
 				   int         target_height)
 {
+	GdkPixbuf *pixbuf;
 	struct jpeg_decompress_struct cinfo;
 	Source src;
 	ErrorHandlerData jerr;
@@ -361,6 +362,7 @@ _gnome_thumbnail_load_scaled_jpeg (const
 	GnomeVFSResult result;
 	unsigned int i;
 	int out_n_components;
+	gchar in_width[16], in_height[16];
 	
 	result = gnome_vfs_open (&handle,
 				 uri,
@@ -454,13 +456,21 @@ _gnome_thumbnail_load_scaled_jpeg (const
 	
 	gnome_vfs_close (handle);
 	
-	return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB,
-					 cinfo.out_color_components == 4 ? TRUE : FALSE,
-					 8,
-					 cinfo.output_width,
-					 cinfo.output_height,
-					 cinfo.output_width * out_n_components,
-					 free_buffer, NULL);
+	pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB,
+					   cinfo.out_color_components == 4 ? TRUE : FALSE,
+					   8,
+					   cinfo.output_width,
+					   cinfo.output_height,
+					   cinfo.output_width * out_n_components,
+					   free_buffer, NULL);
+
+	sprintf (in_width, "%d", cinfo.image_width);
+	sprintf (in_height, "%d", cinfo.image_height);
+  
+	gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Width", in_width);
+	gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Height", in_height);
+
+	return pixbuf;
 }
 
 #endif /* HAVE_LIBJPEG */
Index: libgnomeui/gnome-thumbnail.c
===================================================================
--- libgnomeui/gnome-thumbnail.c	(revision 5298)
+++ libgnomeui/gnome-thumbnail.c	(working copy)
@@ -999,20 +999,25 @@ gnome_thumbnail_factory_generate_thumbna
     return NULL;
 
   width = gdk_pixbuf_get_width (pixbuf);
-  g_object_set_data_full (G_OBJECT (pixbuf), "gnome-thumbnail-width",
-			  g_strdup_printf ("%d", width), g_free);
   height = gdk_pixbuf_get_height (pixbuf);
-  g_object_set_data_full (G_OBJECT (pixbuf), "gnome-thumbnail-height",
-			  g_strdup_printf ("%d", height), g_free);
 
   if (width > size || height > size)
     {
+      const char* in_width, *in_height;
       scale = (double)size / MAX (width, height);
 
       scaled = gnome_thumbnail_scale_down_pixbuf (pixbuf,
 						  floor (width * scale + 0.5),
 						  floor (height * scale + 0.5));
 
+      in_width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
+      in_height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
+      
+      if (in_width)
+	      gdk_pixbuf_set_option (scaled, "tEXt::Thumb::Image::Width", in_width);
+      if (in_height)
+	      gdk_pixbuf_set_option (scaled, "tEXt::Thumb::Image::Height", in_height);
+      
       g_object_unref (pixbuf);
       pixbuf = scaled;
     }
@@ -1175,12 +1180,8 @@ gnome_thumbnail_factory_save_thumbnail (
   close (tmp_fd);
   
   g_snprintf (mtime_str, 21, "%ld",  original_mtime);
-  width = g_object_get_data (G_OBJECT (thumbnail), "gnome-thumbnail-width");
-  if (width == NULL)
-    width = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Width");
-  height = g_object_get_data (G_OBJECT (thumbnail), "gnome-thumbnail-height");
-  if (height == NULL)
-    height = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Height");
+  width = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Width");
+  height = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Height");
 
   if (width != NULL && height != NULL) 
     saved_ok  = gdk_pixbuf_save (thumbnail,
