summary refs log tree commit diff
path: root/winicon.html
blob: 30a5dbcb608ed31f1a7234d27c22f6213a16e12b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Windows Icons</title></head>
<body>
<h1>Windows Icons</h1>
Updated: 12 April 2013
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>

Microsoft Windows icon files

<h2 id="description">DESCRIPTION</h2>

<p>A Microsoft Windows icon file contains one or more images, at
resolutions up to 256 by 256 pixels and various bpp values.  The
images are encoded either as Portable Network Graphics file (PNG), or
in a format similar to Microsoft's BMP format.

<p>If encoded as BMP, the image includes an "AND mask",
which contains 1-bit transparency data.  It may also contain
additional 8-bit transparency data together with the color
information.

<h3 id="colordepth">Color Depth</h3>

Except for the 16 bits per pixel images and images with bit fields, which both
are rare, the colors in all BMP encoded images are RGB with 8 bits per
channel.  Images with bpp values lower than 16 use a palette.

<p>I.e. the bpp value gives the number of distinct colors, not the color
depth.


<h3 id="masks">XOR Mask and AND Mask</h3>

<p>BMP encoded images contain two pixel maps: The so-called "XOR
mask" stores the color information for each pixel, and the
"AND mask" stores the transparency belonging to it.

<p>The names and the function of these maps are most easily
understood by looking at how a 1-bpp icon image is rendered on a
monochrome screen: The pixels on the screen are logically AND-ed with
the bits on the AND mask, then the result is logically XOR-ed with the
bits on the XOR mask.

<p>The result is that if a bit on the AND mask is reset, the corresponding bit
on the XOR mask determines the color of the pixel on the screen.  If a bit in
the AND mask is set and the corresponding bit in the XOR mask is black
(reset), the image is transparent.  Finally, if the bits are set in both the
AND and XOR mask (the pixel on the XOR mask is white), the background of the
screen is inverted.

<p>In color environments, a pixel on the XOR mask outside the opaque area of
the image is usually black and sometimes white, but a color other than black
and white will hardly give predictable results.

<p>Since Windows XP, there may also be an 8-bit transparency channel in 32-bpp
BMP encoded icon images. The AND mask, however, is still required and used
e.g. for generating shadows.

<p>PNG encoded images don't contain AND masks.  While rendering a PNG encoded
image, Windows constructs an AND mask on the fly from the transparency
channel, if present.


<h3 id="evolution">Evolution of Windows Icons</h3>

<p>The Windows icon file format has undergone some extensions since it was
invented in the mid-eighties for Windows&nbsp;1:

<ul>
<li>Windows&nbsp;1 used monochrome 32x32 icons only.
<li>Windows&nbsp;3.0 added color icons with bpp values up to 8.
<li>Windows 4.0 (a.k.a. Windows95) added option for 32-bpp images and
resolutions up to 256 by 256.
<li>NT&nbsp;5.1 (a.k.a. Windows&nbsp;XP) added option for the 8-bit
transparency channel in the unused bits of 32-bpp images.
<li>NT&nbsp;6.0 (a.k.a. Windows&nbsp;Vista) added option for PNG
encoded images
</ul>

<h3 id="resolutions">Common Resolutions and BPP Values</h3>

<p>Typical resolutions and bpp values of the Windows shell icons include:

<table border=1 style="text-align:center">
<?makeman l l l. ?>
<?makeman _ ?>
<tr><th>OS</th><th>resolutions</th><th>bpp values</th></tr>
<tr><td>Windows&nbsp;3</td><td>32x32</td><td>1, 4<br></td></tr>
<tr><td>Windows&nbsp;4</td><td>16x16, 32x32, 48x48</td><td>4, 8</td></tr>
<tr><td>NT&nbsp;5</td><td>16x16, 32x32, 48x48</td><td>4, 8, 32</td></tr>
<tr><td rowspan=3>NT&nbsp;6</td><td>16x16, 32x32, 48x48</td><td>4, 8, 32</td></tr>
<tr><td>24x24, 96x96</td><td>8, 32<br></td></tr>
<tr><td>256x256</td><td>32 (PNG encoded)<br></td></tr>
</table>

<p>Within the icon file, the images with low bpp values are usually
stored first.  With the same bpp value, the images are sorted by
resolution, large images first.


<h3 id="mimetype">MIME Type and File Name Extension</h3>

<p>The MIME type of Windows icon files is registered by IANA as
<b>image/vnd.microsoft.icon</b>, but the unofficial name
<b>image/x-icon</b> is still widely used.

<p>The file name extension (used by Microsoft operating systems as
file type identifier) is <b>.ico</b>.

<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#description">DESCRIPTION</a>
  <ul>
  <li><a href="#colordepth">Color Depth</a>
  <li><a href="#masks">XOR Mask and AND Mask</a>
  <li><a href="#evolution">Evolution of Windows Icons</a>
  <li><a href="#resolutions">Common Resolutions and BPP Values</a>
  <li><a href="#mimetype">MIME Type and File Name Extension</a>
  </ul>
</ul>
</body>
</html>