ICO files contain one or more small images at multiple sizes and colour depths.
The official IANA registered MIME type for ico files is
image/vnd.microsoft.icon. Before this was registered,
image/x-icon was the accepted option that complied with the rules of using x- for unregistered tokens. However, many others are seen, including
application/ico. Many web servers do not come configured with a MIME type setting for .ico files, and may send their default MIME type, which might be
Windows XP adds support for 32-bit colour depth icon images, with transparency taken from the alpha channel of the image, allowing semitransparent areas like shadows and antialiased edges. As the AND bitmap is no longer used, these icon images contain only XOR bitmap data. Windows XP also adds the ability to display icons at up to 96×96 pixel resolution in the graphical shell; however, Microsoft only recommended icon sizes up to 48×48 pixels, so larger icon sizes are uncommon.
Windows Vista adds support for 256×256 pixel icon images, and supports (but does not require) the compressed PNG format for that size. The PNG format encodes the image transparency data directly; it contains neither the XOR nor the AND bitmap data of the other icon image formats. It is recommended that all 256×256 icons should be stored in the ICO file in PNG format to reduce the overall size of the file. The Windows Vista graphical shell supports "zooming" the display in and out; as a result, more icon formats (including the larger, 256×256 format) are recommended.
|Icon Header||Stores general information about the ICO file.|
|Directory[1..n]||Stores general information about every image in the file.|
|Icon #1||The actual "data" for the first image in old AND/XOR DIB format or newer PNG|
|Icon #n||Data for the last icon image|
|0||2||reserved. should always be 0|
|2||2||type. 1 for icon (.ICO), 2 for cursor (.CUR) file|
|4||2||count; number of images in the file|
|0||1||width, should be 0 if 256 pixels|
|1||1||height, should be 0 if 256 pixels|
|2||1||colour count, should be 0 if more than 256 colours|
|3||1||reserved, should be 0|
|4||2||colour planes when in .ICO format, should be 0 or 1, or the X hotspot when in .CUR format|
|6||2||bits per pixel when in .ICO format, or the Y hotspot when in .CUR format|
|8||4||size in bytes of the bitmap data|
|12||4||offset, bitmap data address in the file|