ICO (file format)
≈ 7 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
The ICO file format is an image file format for computer icons in Microsoft Windows. An ICO file holds one or more images at multiple sizes and color depths, from which Windows selects and scales the most appropriate one for a given use. A Windows application's own icon — shown on the desktop, in the Start menu, or in File Explorer — is stored in the same format inside its executable as an icon resource, rather than as a separate file. The CUR file format is an almost identical format for non-animated cursors in Microsoft Windows.
The two differ only in the bytes that identify the file and in a hotspot recorded in the CUR header — the pixel offset, in x,y coordinates, from the top-left corner of the cursor image to the point at which the user is actually pointing. The ANI file format is used for animated Windows cursors. ANI is a RIFF container; each frame within it is a complete CUR-format image and may itself contain images at multiple sizes.
First introduced as monochrome images in Windows 1.0, the format acquired its directory-based multi-image structure in Windows 3.0 and support for larger sizes and higher color depths in Windows 95; Windows Vista added 256×256 images and PNG compression. Each image is stored either as a DIB or as a complete PNG file, and a file typically bundles several so the best match for the requested size and color depth can be chosen.
The ICO file format is an image file format for computer icons in Microsoft Windows. An ICO file holds one or more images at multiple sizes and color depths, from which Windows selects and scales the most appropriate one for a given use. A Windows application's own icon — shown on the desktop, in the Start menu, or in File Explorer — is stored in the same format inside its executable as an icon resource, rather than as a separate file. The CUR file format is an almost identical format for non-animated cursors in Microsoft Windows.
The two differ only in the bytes that identify the file and in a hotspot recorded in the CUR header — the pixel offset, in x,y coordinates, from the top-left corner of the cursor image to the point at which the user is actually pointing. The ANI file format is used for animated Windows cursors. ANI is a RIFF container; each frame within it is a complete CUR-format image and may itself contain images at multiple sizes.
First introduced as monochrome images in Windows 1.0, the format acquired its directory-based multi-image structure in Windows 3.0 and support for larger sizes and higher color depths in Windows 95; Windows Vista added 256×256 images and PNG compression.
Each image is stored either as a DIB or as a complete PNG file, and a file typically bundles several so the best match for the requested size and color depth can be chosen. \text{WidthScore} = \left|\text{EntryWidth} - \text{TargetWidth}\right| \times \begin{cases} 2 & \text{EntryWidth} \text{HeightScore} = \left|\text{EntryHeight} - \text{TargetHeight}\right| \times \begin{cases} 2 & \text{EntryHeight} \text{BppScore} = \left|\text{EntryBpp} - \text{TargetBpp}\right| \times 2 \text{TotalScore} = \text{WidthScore} + \text{HeightScore} + \text{BppScore} Images smaller than the requested size are penalized with a ×2 multiplier.
An entry that scores 0 is an exact match on size and color depth. When two entries have the same score, the one with higher color depth wins. A or value of 0 in is interpreted as 256 for scoring purposes. Because these fields are one byte each, they cannot represent sizes above 256, and the size used for scoring is taken from these directory fields rather than from the embedded image.
For icons, a non-zero gives the size of the color table, and for image-selection purposes Windows derives the color depth as the number of bits needed to represent that many colors — so 2 colors map to 1 bpp, 16 to 4 bpp, and 256 to 8 bpp — the color counts of real indexed images; if is 0, is used directly instead. Cursors have no equivalent field to read: in the cursor form of , is unused and instead holds the hotspot's vertical coordinate (see above).
Through Windows Vista, this meant cursor candidates differing only by color depth could not be distinguished during scoring. From Windows 7 onward, the color depth for cursor scoring is instead read from the cursor's own image data. Earlier versions of Windows further penalized color compression by doubling the color-depth delta a second time; Windows XP dropped this extra penalty so that a 32-bpp icon can be chosen over an 8-bpp one on a 24-bpp display, which the alpha-blended XP user interface relies on.
Although the scoring algorithm is independent of the order in which images are stored, Windows-shipped files follow a consistent convention: modern single-depth icons and cursors store the largest image first, while legacy files containing multiple color depths tend to group their entries in ascending order of color depth (4-bit, then 8-bit, then 32-bit). Third-party icon editors apply the same ascending-depth ordering.
The order matters only when two images tie on both score and color depth: the one stored first is then kept — most likely when no specific size is requested. The values above assume the default cursor size setting (pointer size = 1 in Windows Settings). The cursor size slider scales all five slots proportionally: at pointer size 2 all values double, at size 3 they triple, and so on. and are not affected by the cursor size setting.
See also
Apple Icon Image format BMP file format Computer icon Favicon List of icon software
Notes
References
External links
Icon design guidelines for Windows 10 app icons A Look Inside Windows Icons, Part 1 - PC Mag Jan 26, 1993 Vol.12 No. 2 A Look Inside Windows Icons, Part 2 - PC Mag Feb 9, 1993 Vol.12 No. 3 Enhance Java GUIs with Windows Icons
Text derived from https://en.wikipedia.org/w/index.php?oldid=1378565035 under CC BY-SA 4.0; modifications have been made.