After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 356930 - totem-video-thumbnailer writes bogus metadata tags
totem-video-thumbnailer writes bogus metadata tags
Status: RESOLVED FIXED
Product: libgnomeui
Classification: Deprecated
Component: general
2.16.x
Other All
: Normal minor
: ---
Assigned To: libgnomeui maintainers
libgnomeui maintainers
: 348662 405294 425741 438311 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-09-20 17:04 UTC by Michael Natterer
Modified: 2007-05-14 13:00 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
possible fix (3.72 KB, patch)
2006-12-04 01:10 UTC, mike morrison
none Details | Review

Description Michael Natterer 2006-09-20 17:04:22 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.
Comment 1 Bastien Nocera 2006-09-20 18:43:21 UTC
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
Comment 2 Michael Natterer 2006-09-20 19:49:12 UTC
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.
Comment 3 Bastien Nocera 2006-09-20 19:58:46 UTC
(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
Comment 4 Michael Natterer 2006-09-20 20:07:52 UTC
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.
Comment 5 Christian Neumair 2006-09-22 19:14:57 UTC
You rock so much! Confirming, raising priority.
Comment 6 Kjartan Maraas 2006-10-23 14:06:16 UTC
*** Bug 348662 has been marked as a duplicate of this bug. ***
Comment 7 Kjartan Maraas 2006-12-02 12:47:29 UTC
Any chance of a patch too? :-)
Comment 8 Michael Natterer 2006-12-02 17:04:33 UTC
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.

Comment 9 Kjartan Maraas 2006-12-03 21:50:59 UTC
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?
Comment 10 Bastien Nocera 2006-12-03 23:35:12 UTC
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.
Comment 11 Michael Natterer 2006-12-03 23:41:36 UTC
What would that be good for? If we don't have the original image's
dimensions, use the thumbnail's dimensions anyway?
Comment 12 Michael Natterer 2006-12-03 23:43:50 UTC
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...
Comment 13 Bastien Nocera 2006-12-03 23:45:24 UTC
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.
Comment 14 Michael Natterer 2006-12-04 00:38:01 UTC
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.
Comment 15 mike morrison 2006-12-04 01:10:43 UTC
Created attachment 77610 [details] [review]
possible fix

Why not do something like the attached in the case of image thumbnails?
Comment 16 Alexander Larsson 2006-12-04 08:26:48 UTC
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.
Comment 17 Alexander Larsson 2006-12-04 08:47:10 UTC
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.
Comment 18 Kjartan Maraas 2007-02-02 13:42:18 UTC
Marking the patch needs-work based on alex's comments.
Comment 19 Jens Granseuer 2007-02-19 14:47:46 UTC
*** Bug 405294 has been marked as a duplicate of this bug. ***
Comment 20 Claudio Saavedra 2007-03-09 18:46:35 UTC
Hm, seems I skipped this bug report. For those who care, I attached a patch for the original problem in bug #143470.
Comment 21 Claudio Saavedra 2007-03-16 23:40:42 UTC
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.
Comment 22 Jens Granseuer 2007-04-03 16:52:08 UTC
*** Bug 425741 has been marked as a duplicate of this bug. ***
Comment 23 Luca Cavalli 2007-05-14 13:00:38 UTC
*** Bug 438311 has been marked as a duplicate of this bug. ***