Search code examples
htmlcssimagefavicon

A very strange image/icon file (single file contains the same image with 3 different sizes)


I have this favicon file.

Dowload favicon file

I can not upload the image file since its does not have the proper format.

When you view this file in windows 7, you get the following.

Page 1 of 3

This single file contains the same image but at different sizes. The above shows page 1 of 3.

The following is page 2 of 3 which shows the same image but at a smaller size.

page 2 of 3

And than page 3 of 3 yet again at a more smaller size.

enter image description here

But it is one single file. My question is how is this possible and more importantly how can I make it such? A single file containing the same image with 3 diferrent sizes.

It shows 48px X 48px dimensions. And since favicon is used in web design/development, I have used the html & css tags.


Solution

  • That is just a feature of the .ico file format. Icons frequently need to be displayed at different resolutions, so the format allows different sizes to be packaged together in one file. Some Wikipedia pages on the subject:

    ICO (file format)

    The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately. In Windows, all executables that display an icon to the user, on the desktop, in the Start Menu, or in Windows Explorer, must carry the icon in ICO format.

    Favicon - HTML5 recommendation for icons in multiple sizes

    The current HTML5 specification recommends specifying size icons in multiple sizes using the attributes rel="icon" sizes="space-separated list of icon dimensions" within a <link> tag.[35] Multiple icon formats, including container formats such as Microsoft .ico and Macintosh .icns files, as well as Scalable Vector Graphics may be provided by including the icon's content type in the form of type="file content-type" within the <link> tag.

    To make such a file, you just need a program that is capable of editing .ico files and has access to that feature. The How to make/get a multi size .ico file? question goes into more detail on that.