GNOME Bugzilla – Bug 356930
totem-video-thumbnailer writes bogus metadata tags
Last modified: 2007-05-14 13:00:38 UTC
totem-video-thumbnailer writes tEXt::Thumb::Image::Width and tEXt::Thumb::Image::Height tags which contain the size of the thumbnail, not the size of the "image". I don't know if it's OK to use the "Image" fields for video properties, but i suppose it is. Anyway, these fields are supposed to contain the size of the ogirinal, not of the thmbnail.
totem-video-thumbnail writes bugger all, gdk-pixbuf does. That's how much it does to save: if (gdk_pixbuf_save (small, path, "png", &err, NULL) == FALSE) It *could* save it though. And it now does in CVS. 2006-09-20 Bastien Nocera <hadess@hadess.net> * src/totem-video-thumbnailer.c: (save_pixbuf), (main): Remove duplicate code in the image saving functions, save original video/image's in the PNG's tEXt::Thumb::Image::Width and tEXt::Thumb::Image::Height attributes (Closes: #356930) 2006-09-20 Bastien Nocera <hadess@hadess.net> * src/plparse/test-parser.c: (main): Fix help string
Thanks that was fast :) But apparently it's not totem-video-thumbnail which writes the actual thumbnail file because it writes none of the mandatory thumbnail file tags. It seems to write to a temporary file. I looked at a hexdump of one of the files in question and the creator appars to be something called "GNOME ThumbnailFactory". Now if I knew in which package this thing lives i could reassign the bug accordingly.
(In reply to comment #2) > Thanks that was fast :) > > But apparently it's not totem-video-thumbnail which writes the actual > thumbnail file because it writes none of the mandatory thumbnail > file tags. It seems to write to a temporary file. It doesn't preserve the metadata? > I looked at a hexdump of one of the files in question and the > creator appars to be something called "GNOME ThumbnailFactory". > > Now if I knew in which package this thing lives i could reassign > the bug accordingly. It's libgnomeui in libgnomeui/gnome-thumbnail.h
See initial comment... And here is the bug: gnome_thumbnail_factory_generate_thumbnail() 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); These values later get written into the tags that keep the *image* size, not the thumbnail size.
You rock so much! Confirming, raising priority.
*** Bug 348662 has been marked as a duplicate of this bug. ***
Any chance of a patch too? :-)
Simply removing the lines from comment #4 will fix the wrong values. Better not have width/height values than having the wrong ones :) To really fix it, the original width and height values need to be passed up from the lowlevel loaders.
Adding Alex to Cc: since he's the one who wrote gnome-thumbnail.c. Alex, are you ok with removing the lines as Michael suggests?
The code probably needs to be modified rather than removed. const char *option; option = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width"); if (option != NULL) { g_object_set_data_full (G_OBJECT (pixbuf), "gnome-thumbnail-width", g_strdup (option), g_free); } etc.
What would that be good for? If we don't have the original image's dimensions, use the thumbnail's dimensions anyway?
Err sorry, I misread. Look for the place where it *reads* the "gnome-thumbnail-width/height" strings. There is code that looks for "tEXt::Thumb::Image::Width/Height" as well, so the code I mention should be removed. Unless I miss something here...
Well, it would load the original dimension from the tEXt::Thumb::Image::Width of the thumbnail (created by the thumbnailer itself). Ie., for Totem, the video thumbnailer would write the correct original width/height, and the gnome-thumbnailer code of libgnomeui would preserve it.
Yes, but the code already does that. IMHO we can simply remove all code that fiddles with "gnome-thumbnail-width/height" and it will work. gnome_thumbnail_factory_save_thumbnail(): 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"); --> just get rid of all "gnome-thumbnail-width/height" stuff.
Created attachment 77610 [details] [review] possible fix Why not do something like the attached in the case of image thumbnails?
The code in question seems to be from: date: 2006/01/15 21:48:26; author: kmaraas; state: Exp; lines: +11 -2 2006-01-15 Kjartan Maraas <kmaraas@gnome.org> * gnome-thumbnail.c: (gnome_thumbnail_factory_generate_thumbnail), (gnome_thumbnail_factory_save_thumbnail), (thumb_md5_transform): Save the width and height metadata as suggested by the spec. Patch from James Cape. Closes bug #143470.
Mich: You're only partially right. In the totem case removing the gnome-thumbnail-width/height stuff will make things work, if totem sets the tEXt::Thumb::Image::Height tags. However, for the non-script case where we use gdk-pixbuf to load the image it won't work. In that case we need to get the original size of the image from _gnome_thumbnail_load_scaled_jpeg and gnome_gdk_pixbuf_new_from_uri_at_scale. As such, i think mike morrison is on the right path. I'm not sure I would export the gnome_gdk_pixbuf_new_from_uri_at_scale_full function publically though. Also, it doesn't correctly handle the _gnome_thumbnail_load_scaled_jpeg case. However, these days gdk-pixbuf does the jpeg scaling trick itself, so I don't really think that code is needed, and we should probably just remove it from libgnomeui.
Marking the patch needs-work based on alex's comments.
*** Bug 405294 has been marked as a duplicate of this bug. ***
Hm, seems I skipped this bug report. For those who care, I attached a patch for the original problem in bug #143470.
I've committed to trunk the attachment #84431 [details] for bug #143470, which seems to fix this issue as well. Closing. 2007-03-16 Claudio Saavedra <csaavedra@alumnos.utalca.cl> * libgnomeui/gnome-thumbnail-pixbuf-utils.c: (_gnome_thumbnail_load_scaled_jpeg): Set "gnome-original-width/height" properties in the generated pixbuf. * libgnomeui/gnome-vfs-util.c: (size_prepared_cb), (gnome_gdk_pixbuf_new_from_uri_at_scale): Set "gnome-original-width/height" properties in the generated pixbuf. * libgnomeui/gnome-thumbnail.c: (gnome_thumbnail_factory_generate_thumbnail), (gnome_thumbnail_factory_save_thumbnail): Set the "gnome-original-width/height" properties as metadata in the generated thumbnail. Preserve such info if the helper thumbnailer already provided it. Correctly set tEXt::Image::Width and tEXt::Image::Height metadata tags in thumbnails. Closes bug #143470 and bug #356930.
*** Bug 425741 has been marked as a duplicate of this bug. ***
*** Bug 438311 has been marked as a duplicate of this bug. ***