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 65902 - Selecting an image from a multiple-image file type (like ICO)
Selecting an image from a multiple-image file type (like ICO)
Status: RESOLVED OBSOLETE
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
: 68721 133760 142246 (view as bug list)
Depends on:
Blocks: 76760 167009
 
 
Reported: 2001-12-01 13:22 UTC by Oskar Liljeblad
Modified: 2018-05-22 13:00 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
gdk-pixbuf-collection (24.94 KB, patch)
2002-08-20 06:21 UTC, Anders Carlsson
needs-work Details | Review
animations as collections (47.38 KB, patch)
2002-09-08 00:59 UTC, Matthias Clasen
none Details | Review
animations as collections - ABI unchanged (47.79 KB, patch)
2002-09-08 19:45 UTC, Matthias Clasen
none Details | Review
new patch (86.21 KB, patch)
2002-09-10 20:32 UTC, Matthias Clasen
none Details | Review
new patch (94.93 KB, patch)
2002-09-17 22:41 UTC, Matthias Clasen
none Details | Review

Description Oskar Liljeblad 2001-12-01 13:22:33 UTC
Galeon has the feature to download favicon.ico files when bookmarking
sites. This file contains small images that are used in bookmark menus.
These files may contain more many images of different size.

The problem is that galeon always seems to pick the first image, even if
that isn't the correct size. Then galeon rescales that image to something
like 16x16, which doesn't look good at all.

Example: www.freshmeat.net/favicon.ico 

This file contains three images, as reported by my tool icoutils
(http://freshmeat.net/projects/icoutils/):

--icon --index=0 --width=48 --height=48 --colors=256
--icon --index=1 --width=32 --height=32 --colors=256
--icon --index=2 --width=16 --height=16 --colors=256

Galeon picks the first image and resizes it to 16x16. However, the third
image is already 16x16, and looks much better (no sharp edges). (Use
icoutils or ImageMagick to extract the separate image to see for yourself.)
Comment 1 Yanko Kaneti 2001-12-01 21:12:36 UTC
we use gdk-pixbuf for handling the downloaded icon, i am not sure what
the best solution for this is

probably extending gdk-pixbuf in some nondisturbing manner


like adding a loader api for preselecting the image in the composite one
Comment 2 Jorn Baayen 2002-01-13 19:13:26 UTC
this is something for gdk-pixbuf, not for galeon.
Comment 3 Yanko Kaneti 2002-01-13 20:52:27 UTC
uhm fixed is not really the case, i'll move this to gdk-pixbuf

i strongly suspect this will be WONTFIX
Comment 4 Matthias Clasen 2002-01-14 07:32:56 UTC
Couldn't this be achieved by making the ICO loader do the right
thing wrt. to load_at_size, which has been requested already ?
(see http://bugzilla.gnome.org/show_bug.cgi?id=53726)

On the other hand, there may be compound image types where it would
be more appropriate to have a selection API independend from 
load_at_size.
Comment 5 Yanko Kaneti 2002-01-15 04:22:32 UTC
*** Bug 68721 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2002-01-15 13:31:23 UTC
It may be more appropriate to represent ICO and other compound image
files as GtkIconSource.
Comment 7 Matthias Clasen 2002-07-08 07:36:08 UTC
My current (sort-of) plan for this is to have a new load_collection
method which 
would load all images in a multi-image format and return
an ImageCollection which 
would be similar to an Animation (maybe
Animation should be made a subclass of 
ImageCollection) and also
allow to iterate through all images.

One problem I 
still see with this is that for formats like ico, 
where the multiple images are 
really just variants of one motif,
the app is going to need additional information 
about the variation
to make sensible choices. Some parameters, e.g. size or number 
of
channels are already available from the pixbufs, but others, e.g.
number of 
colors, are not.  
Comment 8 Oskar Liljeblad 2002-07-08 08:05:44 UTC
I think it is OK as long as the application can find out number of 
bits per pixel (1,4,8,16,24 or 32 in the case of ICO files).
Maybe that selection-possiblity should be incorporated into 
http://bugzilla.gnome.org/show_bug.cgi?id=53726 as well?
Comment 9 Anders Carlsson 2002-07-22 16:29:28 UTC
mathias: I have code to to this, I'll wrap up a patch as soon as possible.
Comment 10 Matthias Clasen 2002-08-14 07:47:23 UTC
Anders: code to implement general image collections, or code to
do 
load_at_size_and_depth ?
Comment 11 Anders Carlsson 2002-08-16 06:26:59 UTC
To implement image collections. The code probably clashes with your
patch to implement registration of pixbuf loaders.

I'll attach a patch as soon as I can.
Comment 12 Matthias Clasen 2002-08-19 11:07:37 UTC
Can't wait to see it...
Comment 13 Anders Carlsson 2002-08-20 06:21:44 UTC
Created attachment 10589 [details] [review]
gdk-pixbuf-collection
Comment 14 Anders Carlsson 2002-08-20 06:23:01 UTC
Here's the collection code. I need to refactor some of the io-ico code
to make it work with both collections and single pixbufs so I'll
attach that code later.
Comment 15 Matthias Clasen 2002-08-20 08:35:39 UTC
Hmm, I had envisioned something a bit more abstract, ie,
make the collection class a 
superclass of animation and have
iterators on it - what you have here is just a thinly 
disguised GdkPixbuf*[].

A more abstract implementation would allow to 
implement load_collection in terms of load_animation for animation formats. 
It 
may also allow to load svgs without converting them
to a raster image and represent 
them as a collection with an 
unlimited number of images, which would be rendered on 
demand.

But maybe this is over-the-top, and the simple approach covers
enough 
ground. I'll try to come up with an alternative patch,
then we can compare the 
approaches.

gdk_pixbuf_collection_get_bits_per_sample is 

a) buggy: 
the factor 8 in there is superfluous
b) useless: the pixbuf->bits_per_sampple is 
the number of bits used in the memory representation of the pixbuf and currently 
hardwired to 8. What we are interested in is the bpp/number of colors of the loaded 
image. This information is available to the loader, but is lost unless we attach it to 
the pixbuf in some way, maybe as an option.


Comment 16 Matthias Clasen 2002-08-20 23:51:38 UTC
Sorry, the comments above were based on superficial reading of the
patch. The comment about the uselessness of
gdk_pixbuf_collection_get_bits_per_sample 
doesn't hold any water, since it refers to the non-collection
implementation. I still think that it would be nicer if animations
were just special collections. With the current animation code, there
doesn't even seem to be a simple way to wrap a collection around an
animation, since there is no way to step through it frame-by-frame.

Looking forward to see io-ico-collection.c and the refactored 
io-ico.c... if you refactor io-ico.c please also fix the stupidity
that it continuously decodes its header...
Comment 17 Matthias Clasen 2002-09-07 23:53:18 UTC
Hi Anders, is your collection-loading-ICO-loader still forthcoming ?
Otherwise I might start working on that. I've just finished adding
get_collection methods to the animation classes. Works nicely to
display    
animated gifs or cursors in your testpixbuf-collection. I'll attach a 
patch as soon as canvas stops claiming that I do not exist.
Comment 18 Matthias Clasen 2002-09-08 00:57:11 UTC
Here is the promised patch. Also contains the necessary changes for
incremental collection loading. I've omitted the testpixbuf-collection
stuff from your patch.
Comment 19 Matthias Clasen 2002-09-08 00:59:09 UTC
Created attachment 10959 [details] [review]
animations as collections
Comment 20 Matthias Clasen 2002-09-08 19:43:54 UTC
It occurred to me that adding a virtual function to GdkPixbufAnimation
might be considered an ABI change and thus prevent inclusion of the
patch in 2.2. 
If this is the case, here is an alternative patch which comes without
gdk_pixbuf_animation_get_collection and the get_collection virtual
function, but still supports loading animations as collections.
Comment 21 Matthias Clasen 2002-09-08 19:45:07 UTC
Created attachment 10968 [details] [review]
animations as collections - ABI unchanged
Comment 22 Matthias Clasen 2002-09-10 00:49:30 UTC
loading ico animations is almost done, just needs a bit of cleanup and
robustification before I attach the patch.
Comment 23 Matthias Clasen 2002-09-10 20:32:44 UTC
Created attachment 11008 [details] [review]
new patch
Comment 24 Matthias Clasen 2002-09-10 20:37:45 UTC
The last patch includes a refactored ico loader which loads a
collection  . The three collection implementations (gif, ani and ico)
have been moved into their own .h/.c files. I also added a
gdk_pixbuf_collection_get_static_image which wraps the corresponding
animation functions for gif and ani, and implements the former
selection  algorithm of the ico loader for ico collections. This
ensures that existing users of the ico loader get the same pixbufs as
they used to.

Feedback on the last patch would be most welcome... 
Comment 25 Matthias Clasen 2002-09-17 22:41:03 UTC
Final version for now; these patches are getting large... This one
incorporates some feedback from Owen and gets load_at_size right for
collections.
Comment 26 Matthias Clasen 2002-09-17 22:41:54 UTC
Created attachment 11143 [details] [review]
new patch
Comment 27 Christian Persch 2004-02-08 11:50:31 UTC
*** Bug 133760 has been marked as a duplicate of this bug. ***
Comment 28 Christian Persch 2004-05-10 10:42:09 UTC
*** Bug 142246 has been marked as a duplicate of this bug. ***
Comment 29 Anders Carlsson 2004-12-24 10:28:19 UTC
I finally took the time to look at this. Great work! Being able to see animations as collections is a great 
idea, and this API will work with multiple-page TIFFs as well.

 One minor comment. It looks like gdk_pixbuf_ani_collection_get_static_image should really be 
gdk_pixbuf_ani_collection_load_static_image.

I really do think that this should go into 2.7 as soon as we branch.
Comment 30 John Millikin 2006-10-26 04:37:53 UTC
Has there been any further work on including the patch? There still seems to be no way to easily get multiple images out of an .ico
Comment 31 Tobias Mueller 2017-02-17 09:47:40 UTC
So... ten years later. I bet the patches don't apply any more... What about that functionality?  Is that something still missing?  Is it still desired or solved better differently?
Comment 32 GNOME Infrastructure Team 2018-05-22 13:00:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/1.