GNOME Bugzilla – Bug 755041
How to avoid to scale down thumbnail image file?
Last modified: 2015-10-14 09:21:20 UTC
Currently we are fixing a bug in gnome-font-viewer. As TrueType Collection file (.ttc file) contains several font face, we generated a tiled thumbnail image file, but it is scaled down. In the gnome-font-viewer UI, the preview of the font face becomes blur. how to avoid to scale down thumbnail image file? URL: https://bugzilla.gnome.org/show_bug.cgi?id=752005
I don't understand what you need here. Please attach a test case, and the reason why you think this is a bug. In the future, you should use mailing-lists or IRC to discuss this sort of not too well defined problem.
Created attachment 311335 [details] the tiled thumbnail image file We used the following command to generate the file: $./gnome-thumbnail-font /usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc zenhei.png But as the width is two times larger than default thumbnail width, the final image is scaled down, when use the image in gnome-font-viewer, the preview icon becomes blur.
Created attachment 312268 [details] [review] Proposed patch to avoid to scale down the thumbnail image Please review the patch, thanks.
(In reply to Peng Wu from comment #0) > Currently we are fixing a bug in gnome-font-viewer. > > As TrueType Collection file (.ttc file) contains several font face, > we generated a tiled thumbnail image file, but it is scaled down. > > In the gnome-font-viewer UI, the preview of the font face becomes blur. > > how to avoid to scale down thumbnail image file? Generate it yourself, and fix gnome-thumbnail-font to not resize.
But the scale down happens in gnome-desktop: https://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome-desktop-thumbnail.c#n1443 With the above patch, we can avoid to scale down the image. Just need to add the following line to gnome-font-viewer.thumbnailer: [Thumbnailer Entry] NoScale=true
(In reply to Peng Wu from comment #5) > But the scale down happens in gnome-desktop: > https://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome- > desktop-thumbnail.c#n1443 > > With the above patch, we can avoid to scale down the image. > Just need to add the following line to gnome-font-viewer.thumbnailer: > [Thumbnailer Entry] > NoScale=true Right. This is an API change then.
Review of attachment 312268 [details] [review]: Whether or not to resize cannot be a function of the thumbnailer. The API documentation says that thumbnails will be resized, and, if we wanted to have a way to not resize, it would need to be handled through a new command-line argument for thumbnailers, and new API.
The original problem (bug 752005) is that the thumbnailing API doesn't support multiple thumbnail images per file. To work around that, it was suggested to compose multiple images into a single image, but then it turned out to involve this scaling problem, since the composed image can be too large. So, if there is a cleaner way to handle multiple thumbnail images per file, there shouldn't be a problem. Any suggestions? A humble idea is to let thumbnailers generate multiple images with different suffixes: <...>.png <...>.1.png <...>.2.png Let's call <...>.png "primary" and others "secondary". The number of secondary files is stored in a "tEXt" key of the primary file. gnome_desktop_thumbnail_factory_generate_thumbnail() loads the primary file and secondary files if any, and attach the secondary pixbufs to the primary pixbuf, say using g_object_set_data_full().
(In reply to Daiki Ueno from comment #8) > The original problem (bug 752005) is that the thumbnailing API doesn't > support multiple thumbnail images per file. To work around that, it was > suggested to compose multiple images into a single image, but then it turned > out to involve this scaling problem, since the composed image can be too > large. But *why* do you want to do that? Isn't it easier to add whatever it is you need in the thumbnailer you're calling, and simply bypass the thumbnailing API? This is what totem does to create galleries: https://git.gnome.org/browse/totem/tree/src/plugins/screenshot
(In reply to Bastien Nocera from comment #9) > But *why* do you want to do that? Isn't it easier to add whatever it is you > need in the thumbnailer you're calling, and simply bypass the thumbnailing > API? > > This is what totem does to create galleries: > https://git.gnome.org/browse/totem/tree/src/plugins/screenshot Thanks for the suggestion and the example. It sounds indeed easier and looks straightforward for the gallery image creation. For our case, the application would need to take care of caching by itself, but it might not be a big deal. Peng, what do you think?
Does gnome-desktop thumbnail support the following URI? file:///usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc#0 file:///usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc#1 ... file:///usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc#n If so, maybe we can use "#num" for each font face.
(In reply to Peng Wu from comment #11) > Does gnome-desktop thumbnail support the following URI? No, because gnome-desktop doesn't modify URIs, it just passes them to the thumbnailer.
I mean gnome-font-viewer will request the thumbnail images of the following URI from gnome-desktop: file:///usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc file:///usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc#1 ... file:///usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc#n gnome-font-viewer thumbnailer will handle the new URI in code.
I don't think there's anything left to discuss in this bug. Please carry on the discussion about gnome-font-viewer in a gnome-font-viewer bug.