Ico windows icon format

From Wikipedia, the free encyclopedia

ICO

Filename extension

.ico

Internet media type image/x-icon[1] (but see below)
Uniform Type Identifier (UTI) com.microsoft.ico
Developed by Microsoft
Type of format Graphics file format for computer icons
Container for BMP and PNG
Extended to CUR

CUR

Filename extension

.cur

Internet media type image/vnd.microsoft.icon
Uniform Type Identifier (UTI) com.microsoft.cur
Developed by Microsoft
Type of format Graphics file format for mouse cursors
Container for BMP
Extended from ICO

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 file Explorer, must carry the icon in ICO format.

The CUR file format is an almost identical image file format for non-animated cursors in Microsoft Windows. The only differences between these two file formats are the bytes used to identify them and the addition of a hotspot in the CUR format header; the hotspot is defined as the pixel offset (in x,y coordinates) from the top-left corner of the cursor image to where the user is actually pointing the mouse.[citation needed]

The ANI file format is used for animated Windows cursors.

Icons introduced in Windows 1.0 were 32×32 pixels in size and were monochrome.[2] Support for 16 colors was introduced in Windows 3.0.[citation needed]

Win32 introduced support for storing icon images of up to 16.7 million colors (TrueColor) and up to 256×256 pixels in dimensions.[3] Windows 95 also introduced a new Device Independent Bitmap (DIB) engine.[4] However, 256 color was the default icon color depth in Windows 95. It was possible to enable 65535 color (Highcolor) icons by either modifying the Shell Icon BPP value in the registry[3][5] or by purchasing Microsoft Plus! for Windows 95. The Shell Icon Size value allows using larger icons in place of 32×32 icons and the Shell Small Icon Size value allows using custom sizes in place of 16×16 icons.[3] Thus, a single icon file could store images of any size from 1×1 pixel up to 256×256 pixels (including non-square sizes) with 2 (rarely used), 16, 256, 65535, or 16.7 million colors; but the shell could not display very large sized icons. The notification area of the Windows taskbar was limited to 16 color icons by default until Windows Me when it was updated to support high color icons.

Windows XP added support for 32-bit color (16.7 million colors plus 8-bit alpha channel transparency) icon images, thus allowing semitransparent areas like shadows, anti-aliasing, and glass-like effects to be drawn in an icon. Windows XP, by default, employs 48×48 pixel icons in Windows Explorer. Windows XP can be forced to use icons as large as 256×256 by modifying the Shell icon size value but this would cause all 32×32 icons throughout the shell to be upscaled.[3] Microsoft only recommended icon sizes up to 48×48 pixels for Windows XP.[6] Windows XP can downscale larger icons if no closer image size is available.[3]

Windows Vista added full support for 256×256-pixel 32-bit color icons,[Notes 1] as well as support for the compressed PNG format. Although compression is not required, Microsoft recommends that all 32-bit color 256×256 icons in ICO files should be stored in PNG format to reduce the overall size of the file. The Windows Vista Explorer supports smoothly scaling icons to non-standard sizes which are rendered on the fly even if an image is not present for that size in the icon file. The Windows Vista shell adds a slider for «zooming» the icon sizes in and out. With users using higher resolutions and high DPI modes, larger icon formats (such as 256×256) are recommended.[7][8]

While the IANA-registered MIME type for ICO files is image/vnd.microsoft.icon,[9] it was submitted to IANA in 2003 by a third party and is not recognised by Microsoft software, which uses image/x-icon or image/ico instead.[10][11] Erroneous types image/ico, image/icon, text/ico and application/ico have also been seen in use.[9]

Icon file structure

[edit]

An ICO or CUR file is made up of an ICONDIR («Icon directory») structure, containing an ICONDIRENTRY structure for each image in the file, followed by a contiguous block of all image bitmap data (which may be in either Windows BMP format, excluding the BITMAPFILEHEADER structure, or in PNG format, stored in its entirety).[3]

Images with less than 32 bits of color depth follow a particular format: the image is encoded as a single image consisting of a color mask (the «XOR mask») together with an opacity mask (the «AND mask»).[6][3] The XOR mask must precede the AND mask inside the bitmap data; if the image is stored in bottom-up order (which it most likely is), the XOR mask would be drawn below the AND mask. The AND mask is 1 bit per pixel, regardless of the color depth specified by the BMP header, and specifies which pixels are fully transparent(1) and which are fully opaque(0). The XOR mask conforms to the bit depth specified in the BMP header and specifies the numerical color or palette value for each pixel. Together, the AND mask and XOR mask make for a non-transparent image representing an image with 1-bit transparency; they also allow for inversion of the background. The height for the image in the ICONDIRENTRY structure of the ICO/CUR file takes on that of the intended image dimensions (after the masks are composited), whereas the height in the BMP header takes on that of the two mask images combined (before they are composited). Therefore, the masks must each be of the same dimensions, and the height specified in the BMP header must be exactly twice the height specified in the ICONDIRENTRY structure.[12]

32-bit images (including 32-bit BITMAPINFOHEADER-format BMP images[Notes 2]) are specifically a 24-bit image with the addition of an 8-bit channel for alpha compositing. Thus, in 32-bit images, the AND mask is not required, but recommended for consideration. Windows XP and higher will use a 32-bit image in less than True color mode by constructing an AND mask based on the alpha channel (if one does not reside with the image already) if no 24-bit version of the image is supplied in the ICO/CUR file. However, earlier versions of Windows interpret all pixels with 100% opacity unless an AND mask is supplied with the image. Supplying a custom AND mask will also allow for tweaking and hinting by the icon author. Even if the AND mask is not supplied, if the image is in Windows BMP format, the BMP header must still specify a doubled height.

It’s important to note that in the AND mask, as for the pixel array of the bitmap, padding bytes must be appended to the end of each row in order to bring up its length to a multiple of four bytes since it’s basically a (monochrome) bitmap.[3] The AND mask of an 8×8 pixels bitmap would have 1 byte of data and 3 bytes of padding(8*8*1bpp = 64 bits/8 = 8 bytes of total rows, so each row is 1 byte and 3 bytes of padding are needed), a 16×16 bitmap’s AND mask would have 2 bytes of data and 2 bytes of padding, a 32×32 bitmap’s AND mask would have 4 bytes of data and no padding. Note that the quantity of padding bytes needed depend on the dimensions of the bitmap and not its color depth since the AND mask is 1 bit per pixel regardless.

All values in ICO/CUR files are represented in little-endian byte order.

ICONDIR structure

Offset# Size Purpose
0 2 Reserved. Must always be 0.
2 2 Specifies image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid.
4 2 Specifies number of images in the file.

Structure of image directory

[edit]

Image entry

Image #1 Entry for the first image
Image #2 Entry for the second image
Image #n Entry for the last image

ICONDIRENTRY structure

Offset# Size Purpose
0 1 Specifies image width in pixels. Can be any number between 0 and 255. Value 0 means image width is 256 pixels.[Notes 1]
1 1 Specifies image height in pixels. Can be any number between 0 and 255. Value 0 means image height is 256 pixels.[Notes 1]
2 1 Specifies number of colors in the color palette. Should be 0 if the image does not use a color palette.
3 1 Reserved. Should be 0.
4 2
  • In ICO format: Specifies color planes. Should be 0 or 1.[Notes 3]
  • In CUR format: Specifies the horizontal coordinates of the hotspot in number of pixels from the left.[Notes 4]
6 2
  • In ICO format: Specifies bits per pixel. [Notes 5]
  • In CUR format: Specifies the vertical coordinates of the hotspot in number of pixels from the top.[Notes 4]
8 4 Specifies the size of the image’s data in bytes
12 4 Specifies the offset of BMP or PNG data from the beginning of the ICO/CUR file

Referenced image data

[edit]

All image data referenced by entries in the image directory proceed directly after the image directory. It is customary practice to store them in the same order as defined in the image directory.

If an image is stored in BMP format, it must exclude the opening BITMAPFILEHEADER structure.

The height of the BMP image must be twice the height declared in the image directory. This is because the actual image data will contain two parts: the actual image immediately followed by a 1 bit mask of the same size as the image used to determine which pixels will be drawn.

The mask has to align to a DWORD (32 bits) and should be packed with 0s. A 0 pixel means ‘the corresponding pixel in the image will be drawn’ and a 1 means ‘ignore this pixel’. The pixel colour is either explicit for 24 and 32 bit versions (which do not have colour tables), indexed for the other depths (1,2,4,8,16) in table of a four byte (BGRA) colours that follows the BITMAPINFOHEADER.

For 1 bit, typically the two colours are #00000000 and #00FFFFFF and the A channel is ignored.

The pixel data for 1,2,4,8 and 16 bits is packed by byte and DWORD aligned.

24 bit images are stored as B G R triples but are not DWORD aligned.

32 bit images are stored as B G R A quads.

Originally, ICOs and CURs were intended to be used on monochrome displays and used the formula Output = (Existing AND Mask) XOR Image but on colour screens, the cursor is composed using A channel blending and the mask is used to determine which pixels are included or excluded.

If an image is stored in PNG format, then there is no BITMAPINFOHEADER and the contents of the PNG image in full are used instead.

The ability to read PNG images from ICO format images was introduced in Windows Vista.[7] A PNG image can be stored in the image in the same way as done for a standard Windows BMP format image, with the exception that the PNG image must be stored in its entirety, with its file header in 32bpp ARGB format.[7]

Note: CUR files cannot use PNG image data and must use BMP image data as per ICOs.[7]

Icon and cursor resources

[edit]

Icons and cursors in Portable Executable (EXE or DLL) files are organised in resources of type RT_GROUP_ICON, RT_GROUP_CURSOR, RT_ICON and RT_CURSOR.[13]

RT_GROUP_ICON and RT_GROUP_CURSOR resources contain NEWHEADER structure and one or more RESDIR structures which have almost the same format as corresponding ICONDIR and ICONDIRENTRY structures in ICO/CUR files. Main difference is in RESDIR that the last member of the structure contains two-byte resource identifier of the RT_ICON/RT_CURSOR instead of image offset in the file.

NEWHEADER/RESDIR structures also referred as GRPICONDIR/GRPICONDIRENTRY in many sources.[14]

NEWHEADER structure

Offset# Size Purpose
0 2 Reserved. Must always be 0.
2 2 Specifies resource type: 1 for icon resource, 2 for cursor resource. Other values are invalid.
4 2 Specifies the number of RESDIR structures that immediately follow the NEWHEADER structure.

RESDIR structure

Offset# Size Purpose
0 For icon: 1 * Specifies image width in pixels. Can be any number between 0 and 255. Value 0 means image width is 256 pixels.[Notes 1]
For cursor: 2
2 For icon: 1 * Specifies image height in pixels. Can be any number between 0 and 255. Value 0 means image width is 256 pixels.[Notes 1]
For cursor: 2
2 1 * For icon resource: Specifies number of colors in the color palette. Should be 0 if the image does not use a color palette.
3 1 * For icon resource: Reserved. Should be 0.
4 2 Specifies color planes. Should be 0 or 1.[Notes 3]
6 2 Specifies bits per pixel.[Notes 5]
8 4 Specifies the size of the resource, in bytes.
12 2 Unique ordinal identifier of the RT_ICON or RT_CURSOR resource.

RT_ICON and RT_CURSOR resources have the same image data format as in ICO files and can store PNG images as well. Additionally, first four bytes of RT_CURSOR resource data contain the cursor hotspot data, as two WORD (16 bit) values (in contrast to CUR files, in which hotspot data is contained in the ICONDIRENTRY structure).[15]

An icon library is a way to package Windows icons. It is typically a 16-bit New Executable or a 32-bit Portable Executable binary file having an .ICL extension with icon resources being the packaged icons. Windows Vista and later versions do not support viewing icons from 16-bit (New Executable) files.[16]

  • Apple Icon Image format
  • BMP file format
  • Computer icon
  • Favicon
  • List of icon software
  1. ^ a b c d e Since Windows 95 size of an image in the ICONDIRENTRY structure might be set to zero, which means 256 pixels. Since Windows Vista, the size of an image is determined from the BITMAPINFOHEADER structure or PNG image data which technically allows storing icons with larger than 256 pixels, but such larger sizes are not recommended by Microsoft.
  2. ^ The classic BITMAPINFOHEADER bitmap format supports storing images with 32 bits per pixel. When saved as a standalone .BMP file, «the high byte in each [pixel] is not used». However, when this same data is stored inside a ICO or CUR file, Windows XP (the first Windows version to support ICO/CUR files with more than 1 bit of transparency) and above interpret this byte as an alpha value.
  3. ^ a b Setting the color planes to 0 or 1 is treated equivalently by the operating system, but if the color planes are set higher than 1, this value should be multiplied by the bits per pixel to determine the final color depth of the image. It is unknown if the various Windows operating system versions are resilient to different color plane values.
  4. ^ a b
    «Windows XP icon and cursor support». Microsoft. November 18, 2005. Archived from the original on 2011-06-30. Retrieved 2023-07-03. The cursor is loaded properly at whatever color depth the cursor was authored. However, the system cannot distinguish between multiple candidates in the same cursor file or resource that differ only by their color depths. Icons, however, fully support multiple icon candidates with varying color depths.
  5. ^ a b The bits per pixel might be set to zero, but can be inferred from the other data; specifically, if the bitmap is not PNG compressed, then the bits per pixel can be calculated based on the length of the bitmap data relative to the size of the image. If the bitmap is PNG compressed, the bits per pixel are stored within the PNG data. It is unknown if the various Windows operating system versions contain logic to infer the bit depth for all possibilities if this value is set to zero.
  1. ^ «MIME Sniffing Standard». WHATWG. January 17, 2014. Archived from the original on 2014-03-27. Retrieved 2014-04-18.
  2. ^ Fekete, Gyorgy (March 11, 2009). «Operating System Interface Design Between 1981-2009». Webdesigner Depot. Retrieved June 6, 2011.
  3. ^ a b c d e f g h Hornick, John (September 29, 1995). «Icons». Windows User Interface Technical Articles (MSDN). Microsoft Corporation. Retrieved June 5, 2011.
  4. ^ «Windows 95 Architecture Components». Microsoft TechNet. Microsoft Corporation. Retrieved June 6, 2011.
  5. ^ «Shell Icon BPP». Windows 2000 Registry Reference (Microsoft TechNet). Microsoft Corporation. Retrieved June 6, 2011.
  6. ^ a b «Creating Windows XP Icons». Windows XP Technical Articles (MSDN). Microsoft Corporation. July 2001. Retrieved 2022-11-27.
  7. ^ a b c d Chen, Raymond (October 22, 2010). «The evolution of the ICO file format, part 4: PNG images». The Old New Thing — Microsoft Developer Blogs. Retrieved 2022-11-27.
  8. ^ «Icons (Design basics) — Win32 apps». learn.microsoft.com. 9 February 2021. Icons have a maximum size of 256×256 pixels, making them suitable for high-dpi (dots per inch) displays. These high-resolution icons allow for high visual quality in list views with large icons… Only a 32-bit copy of the 256×256 pixel image should be included, and only the 256×256 pixel image should be compressed to keep the file size down.
  9. ^ a b Butcher, Simon (3 Sep 2003). «image/vnd.microsoft.icon». Retrieved 3 Jan 2014.
  10. ^ Lawrence, Eric (11 Feb 2011). «IE9 RC Minor Changes List». IEInternals. MSDN Blogs. Retrieved 20 Aug 2016. We use «image/x-icon» because that’s the MIME type we’ve always used. Someone at some point (AFAIK, not related to Microsoft) proposed registration of the MIME type as «vnd.microsoft.icon», but Windows doesn’t actually use that, it uses image/x-icon. See the second comment.
  11. ^ Windows Imaging Component — ICO Format Overview
  12. ^ Chen, Raymond (2010-10-19). «The evolution of the ICO file format, part 2: Now in color!». The Old New Thing. Retrieved 2022-12-30.
  13. ^ «Resource File Formats — Win32 apps». learn.microsoft.com. 2020-08-19. Retrieved 2023-05-22.
  14. ^ Chen, Raymond (July 20, 2012). «The format of icon resources». The Old New Thing — Microsoft Developer Blogs. Retrieved 2023-05-20.
  15. ^ «LOCALHEADER structure — Win32 apps». learn.microsoft.com. 2020-12-11. Retrieved 2023-05-22.
  16. ^ Chen, Raymond (May 2008). «Windows Confidential — 16-Bit Icons Are So Passé». TechNet Magazine. Retrieved November 27, 2022.
  • Icon design guidelines for Windows Vista icons
  • Icon design guidelines for Windows 10 app icons
  • Icons (1995 Microsoft Technical Article)
  • The evolution of the ICO file format (Part 1, Part 2, Part 3, Part 4)
  • The format of icon resources
  • The format of icon resources, revisited
  • 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
  • Enable High Color Icons in Windows 95 and later
  • Enhance Java GUIs with Windows Icons

Relevant source files

  • ico/d3.ico
  • ico/program_exe.ico
  • ico/program_install.ico

Purpose and Scope

This document provides detailed technical specifications of the ICO file format as used in the Folder-Ico repository. It outlines the binary structure of ICO files, their headers, directory entries, and image data formats. This information is essential for developers who need to work with, validate, or generate compliant ICO files. For information about how PNG image data is embedded within ICO files, see PNG Data in ICO Files.

Overview of ICO Format

The ICO format is Microsoft’s standard format for icon files in Windows operating systems. Each ICO file serves as a container that can hold multiple icon images in different sizes, color depths, and resolutions. This allows applications to select the most appropriate icon representation based on display settings.


Sources: ico/program_install.ico1-10

The ICO file starts with a fixed-size header that contains basic information about the file type and the number of images contained within.


Field Size Description
Reserved 2 bytes Always 0
Type 2 bytes 1 for ICO format (icons), 2 for CUR format (cursors)
Image Count 2 bytes Number of images stored in the file

In the repository’s ICO files, the header typically indicates the file is an ICO file (type=1) and contains multiple images in different sizes.

Sources: ico/program_install.ico1-2

Icon Directory

Following the header is the icon directory, which consists of a series of entries, one for each image in the file. Each entry provides metadata about the corresponding image and indicates where its data is located within the file.


Directory Entry Structure

Each directory entry is 16 bytes in size and structured as follows:

Field Size Description
Width 1 byte Icon width in pixels (0 means 256)
Height 1 byte Icon height in pixels (0 means 256)
Color Count 1 byte Number of colors (0 means 256 or more colors)
Reserved 1 byte Should be 0
Color Planes 2 bytes Color planes in the icon (usually 0 or 1)
Bits Per Pixel 2 bytes Bits per pixel (e.g., 1, 4, 8, 24, 32)
Size 4 bytes Size of the image data in bytes
Offset 4 bytes Offset to the image data from the beginning of the file

The directory entries in Folder-Ico’s icons typically include variants with different bit depths, with 32-bit (RGBA) being common for high-quality icons.

Sources: ico/program_install.ico1-10

Image Data Formats

The ICO format supports two main types of image data: BMP (legacy format) and PNG (modern format). The structure differs based on the format used.


BMP Format (Legacy)

For BMP format, the image data consists of:

  1. DIB (Device-Independent Bitmap) header:

    • Usually the BITMAPINFOHEADER structure (40 bytes)
    • Specifies dimensions, color depth, and compression
  2. Pixel data:

    • XOR mask (color data)
    • AND mask (transparency mask for older formats)

PNG Format (Modern)

For PNG format, the image data is a standard PNG file with:

  1. PNG signature: The bytes 89 50 4E 47 0D 0A 1A 0A
  2. PNG chunks (IHDR, IDAT, IEND, etc.)

The PNG format is preferred in modern icons because it provides:

  • Better compression
  • True alpha channel transparency
  • Wider color support
  • Better cross-platform compatibility

In the Folder-Ico repository, many icons use the PNG format embedded within the ICO container to provide high-quality icons with transparency.

Sources: ico/program_install.ico2-246

Multi-Size Icon Storage

One of the key features of the ICO format is its ability to store multiple images of different sizes within a single file. This allows applications to choose the most appropriate size based on the display context.


Common Icon Sizes in Repository

The Folder-Ico repository includes ICO files with multiple image sizes to ensure compatibility with different display contexts. Common sizes include:

Size Typical Use
16×16 System tray, file explorers (small view)
24×24 Menu items, toolbars
32×32 File explorers (medium view), desktop icons
48×48 File explorers (large view)
64×64 File explorers (extra-large view)
128×128 Alt+Tab preview, Start menu (large tiles)
256×256 High-DPI displays, zoomed views

Each size version is stored as a separate image entry within the ICO file.

Sources: ico/program_install.ico1-274

ICO File Byte Structure Example

The actual byte structure of an ICO file follows this pattern:

Offset    Size    Description
------    ----    -----------
0x0000    2       Reserved (0)
0x0002    2       Type (1 for ICO)
0x0004    2       Image count

// For each image, there's a directory entry:
0x0006    1       Width of first image
0x0007    1       Height of first image
0x0008    1       Color count
0x0009    1       Reserved (0)
0x000A    2       Color planes
0x000C    2       Bits per pixel
0x000E    4       Size of image data
0x0012    4       Offset to image data

// More directory entries follow...

// Image data starts at the specified offsets

The complexity of ICO files lies in their format flexibility, particularly in how they handle the image data (BMP or PNG) and the organization of multiple images of different sizes.

Sources: ico/program_install.ico1-10

ICO Format Limitations and Considerations

Despite its versatility, the ICO format has certain limitations and special considerations that developers should be aware of:

Limitation Description
Maximum Dimensions Traditional ICO format supports images up to 256×256 pixels
Format Compatibility Older applications may only recognize BMP format icons, not PNG
Color Depth Support Some applications may not properly display 32-bit color depth icons
Transparency AND mask transparency (BMP) is less sophisticated than alpha channel (PNG)
Multiple Sizes Including multiple size variants increases file size

For optimal compatibility, the Folder-Ico repository typically includes multiple size variants in each ICO file, with both high-quality PNG data for modern systems and BMP data for legacy support.

Sources: ico/program_install.ico1-274

Relationship to System Architecture

Within the Folder-Ico repository, ICO files serve as the primary visual assets and are paired with hash files for integrity verification.


Understanding the ICO file format is essential for developers working with the Folder-Ico repository, as it helps ensure the correct generation, modification, and validation of icon files within the system.

Sources: ico/program_install.ico1-274

ICO (Windows Icon) Format

An easy way to create your web site’s
favourites/shortcut/bookmark icon in Photoshop.
FREE, $5 donation suggested if you love the plugin.
(MacHouse has a video tutorial on making a favicon.)

  • More information
  • Български
  • Dansk
  • Deutsch
  • Ελληνικά
  • Español
  • فارسی
  • français
  • עברית
  • हिंदी
  • Hrvatski
  • Bahasa indonesia
  • italiano
  • 日本語
  • Magyar
  • Nederlands
  • Norsk
  • polski
  • português
  • pt-BR
  • Română
  • Pyccĸий
  • Українська
  • Slovenščina
  • svenska
  • 简体中文

(If you’re looking for a plugin for OS X ‘icns’ icons,
try Zonic IconLab.)

Материал из РУВИКИ — свободной энциклопедии

У этого термина существуют и другие значения, см. ICO.

ICO, Windows icon
Расширение .ico
MIME-тип image/vnd.microsoft.icon[1]
Разработчик Майкрософт
Тип формата растровая графика

ICO (Windows icon) — формат хранения файлов значков в Microsoft Windows.

Формат ICO аналогичен формату CUR (Windows cursors), предназначенному для хранения курсоров. Отличие состоит в численном значении одного поля в заголовочной структуре и интерпретации значений двух других полей этой же структуры.

Один ICO-файл содержит один или несколько значков разных размеров и разрешений. Размер значка может быть любым, но наиболее употребимы квадратные значки со стороной 16, 32 и 48 пикселей. Также используются значки с размером 24, 40, 60, 72, 92, 108, 128 пикселей.

Значки бывают в естественном цвете (True Color, глубина цвета 24 бит), High Color (глубина цвета 16 бит) или с фиксированной палитрой (из двухсот пятидесяти шести, шестнадцати или всего из двух цветов). В этом случае число, соответствующее каждому пикселю, указывает не на цвет, а на номер цвета в палитре.

По своей структуре изображения в файле ICO наиболее близки к BMP, но принципиально отличаются от них наличием дополнительного изображения — маски, накладываемой на задний план при помощи операции побитового «И», что позволяет реализовать (полную) прозрачность рисунка. Последующее наложение основного изображения с помощью «исключающего ИЛИ» может даже дать «инверсные» пиксели в тех местах, где задний план не был замаскирован.

Кроме того, начиная с Windows XP поддерживаются 32-битные значки — каждому пикселу соответствует 24-бита цвета и 8-битный альфа-канал, позволяющий реализовать 256 уровней частичной прозрачности. С помощью альфа-канала можно отображать значки со сглаженными (размытыми) краями и тенью, сочетающимися с любым фоном; маска в этом случае игнорируется.

Начиная с Windows Vista, формат поддерживает размеры значков более 256 пикселей на сторону и сжатие с помощью формата PNG. В этом случае маска не содержится в файле отдельно, а генерируется автоматически из альфа-канала PNG изображения.[2]

Файл состоит из заголовка фиксированной длины, каталога информации о изображениях и непосредственно изображений.

Заголовок[править | править код]

Заголовок имеет размер 6 байт:

Поле Смещение
(в байтах)
Размер
(в байтах)
Описание
reserved 0 2 Зарезервировано. Всегда 0.
type 2 2 Тип файла:

  • 1 для значков (.ICO)
  • 2 для курсоров (.CUR)

Иные значения недопустимы.

count 4 2 Количество изображений в файле, минимум 1.

Каталог информации об изображениях[править | править код]

Представляет собой последовательные записи фиксированного размера (16 байт), следующие одна за другой. Количество записей определяется полем count заголовка.

Часть полей может содержать 0 и легко получается из других данных; например, если изображение не хранится в формате PNG, тогда количество битов на пиксель рассчитывается на основе информации о размере растра, а также его ширине и высоте.

Поле Смещение Размер
(в байтах)
Описание
width 0 1 Указывает ширину изображения в точках. Может принимать значения от 0 до 255. Если указано 0, то изображение имеет ширину 256 точек или более.
height 1 1 Указывает высоту изображения в точках. Может принимать значения от 0 до 255. Если указано 0, то изображение имеет высоту 256 точек или более.
colors 2 1 Указывает количество цветов в палитре изображения. Для полноцветных значков должно быть 0.
reserved 3 1 Зарезервировано. Должно быть 0.
planes 4 2
  • В .ICO определяет количество плоскостей. Может быть 0 или 1.
  • В .CUR определяет горизонтальную координату «горячей точки» в пикселях относительно левого края изображения.
bpp 6 2
  • В .ICO определяет количество битов на пиксель (bits-per-pixel). Это значение может быть 0.
  • В .CUR определяет вертикальную координату «горячей точки» в пикселях относительно верхнего края изображения.
size 8 4 Указывает размер растра в байтах
offset 12 4 Указывает абсолютное смещение структуры BITMAPINFOHEADER или данных PNG в файле.
  • Значок
  • favicon
  • Глубина цвета
  1. http://www.iana.org/assignments/media-types/image/vnd.microsoft.icon
  2. Chen, Raymond The evolution of the ICO file format, part 4: PNG images (амер. англ.). The Old New Thing — Microsoft Developer Blogs (22 октября 2010). Дата обращения: 27 ноября 2022.

Download Article

Simple ways to save icons as Windows .ICO files

Download Article

  • Online File Converter
  • |

  • Paint on Windows
  • |

  • Preview on Mac
  • |

  • Photoshop
  • |

  • Video

Need to make an icon in the Windows ICO icon format? If you are designing an application or a website or want to personalize your Windows desktop, you can make an ICO file using an image converter website, the Paint app, Photoshop, and even Preview for macOS. This wikiHow article will show you the easiest ways to create Windows icon files on your PC or Mac.

How to Make a Windows Icon File

To quickly convert any image to ICO, upload a JPG, PNG, or BMP image to an online converter like ICOconvert, crop it to your liking, and then download it as an ICO file in your preferred size. If you have a Mac, you can export an image as an ICO file without a converter.

  1. Step 1 Open https://icoconvert.com/ in...

    Open https://icoconvert.com/ in your internet browser. Icoconvert is a free online image converter that allows you to upload images and convert them to ICO files. It also has options for creating a style for the ICO image, and you can save it in multiple sizes in one file. This allows the image to scale to different sizes depending on its use.

    • Other image converter sites that work similarly include ICOConverter (https://www.icoconverter.com) and Online-Convert (https://image.online-convert.com/convert-to-ico).
    • You can use online file converters in all desktop and mobile internet browsers.
  2. Step 2 Click the Choose File button and select an image.

    This button is under the «Step 1: Upload an Image» heading at the top. It will open your file navigator window and allow you to select your image. Use the navigation window to navigate to the image file you want to select, then click Open.

    Advertisement

  3. Step 3 Click Upload.

    It’s the large file below the «Choose File» button. This uploads the file to the website. Allow a few minutes for it to complete.

  4. Step 4 Crop the image (optional).

    Cropping your image allows you to trim the excess areas around the image that you don’t want to use. Click and drag a square around the area of the image you want to keep.

  5. Step 5 Select a style (optional).

    Icoconvert allows you to select different styles for your ICO images. These styles are different image shapes and borders. To select a style, scroll down and click the styles you want to use below the «Step 3. Apply Styles» header. You can select more than one style.

  6. Step 6 Select an icon format.

    If you want to make an ICO file for Windows, select ICO for Windows 10, 11, 7, and 8. If you want to make a custom icon size, select Custom sizes. ICO files can be multiple sizes that scale to fit their use. If you want to keep the ICO file the same size as the image you uploaded, select «Custom sizes» and click the radio option next to «Original Size.» If you want to adjust the file size or create a scalable ICO file, click the radio option next to «Multi-size in one icon» and then click the checkbox next to all the sizes you want the ICO file to be able to take.

    • You’ll also have the option to make a Favicon for your website or a PNG file for other platforms.
  7. Step 7 Click Convert ICO.

    It’s the first button below «Steps 5. Convert and Download.» This converts the file you uploaded to the image file that you selected.

    • Alternatively, you can click PNG to ICO to convert a PNG file to an ICO file. Click Resize image to change the image size. Click Compress image to make the image file size smaller, and click PNG to SVG to convert a PNG file to a scalable vector graphic file.
  8. Step 8 Click Download your icon(s).

    It’s the blue text that appears below the «Convert ICO» button when you click it. This downloads your image files in the file format you selected. You can find your image files in your «Downloads» folder.

  9. Advertisement

  1. Step 1 Open MS Paint.

    Paint is a basic graphics editing program that comes preinstalled on all versions of Windows, including Windows 10 and Windows 11.[1]
    You can use Paint to create files you can easily convert to ICO files. To open it, type paint into the Windows search bar and click Paint in the search results.

    • If you’re using Windows 11, the latest version of Paint allows you to create a transparent background for your icon.
  2. Step 2 Create or open an image.

    To open an existing image you want to convert to an ICO, go to File > Open and select the file. Alternatively, you can use the Paint tools to draw your own image.

    • Because Paint for Windows 11 now features layers, you create an icon in Paint and make the background layer transparent. However, this won’t work if you open an existing image in Paint.
  3. Step 3 Resize the image so that it is the size of an icon.

    Most ICO files are typically square images that are 32 x 32 pixels. They can be as large as 256 x 256 pixels or as small as 16 x 16 pixels. Larger files can scale down to smaller sizes, but small files cannot be enlarged without looking pixelated and distorted. To resize the image:

    • In Windows 10, click Resize in the box that says «Image» in the menu bar at the top. On Windows 11, click the icon in the «Image» panel that looks like a drawing of a mountain with an arrow pointing up and to the right.
    • Click the radio option next to Pixels.
    • Enter the height and width of the file in pixels (i.e., 256 x 256) next to «Vertical» and «Horizontal.» If it doesn’t let you make the two values the same, click the chain icon to unlink the sizes (Windows 11) or uncheck «Maintain aspect ratio» (Windows 10).
    • Click OK.
  4. Step 4 Make the background transparent (Windows 11 only).

    If you only want to keep the subject of your icon and not the background, you can make the background transparent. This will only work if you drew the icon in Paint and didn’t open an existing image file.

    • Click Layers at the top-right to show the layers.
    • Hover your mouse over the background layer at the bottom of the layers list.
    • Click the eye icon on the background layer to hide it. The background will now have a gray checkerboard pattern to indicate that it is transparent.
  5. Step 5 Save the file as a PNG file.

    This common file type is easy to convert to ICO and retains background transparency if present. Here’s how:

    • Click File menu and select Save as.
    • Select the PNG file type.
    • Type a file name and saving location.
    • Click Save.
  6. Step 6 Use ICOConvert to convert the PNG to an ICO file.

  7. Advertisement

  1. Step 1 Open the image you want to convert in Preview.

    Typically, you can open an image in Preview by double-clicking the file. If Preview is not your default image viewer, you can use the following steps to open an image in Preview.

    • Right-click (or Command-click) the image.
    • Select Open with.
    • Click Preview.app.
    • Just keep in mind that the ICO format is Windows-specific, so you won’t be able to use these icons on your Mac. Mac icons use the .ICNS format.
  2. Step 2 Resize the image to a square in the size of an icon.

    Most ICO files are typically square images that are 32 x 32 pixels. They can be as large as 256 x 256 pixels or as small as 16 x16 pixels. Larger files can scale down to smaller sizes, but small files cannot be enlarged without looking pixelated and distorted. To resize the image:

    • Click the Markup icon at the top (the marker icon) if the Markup toolbar isn’t showing.[2]
    • Click the Adjust Size button, which is a square with smaller squares and rectangles inside.
    • Select Pixels in the drop-down menu to the right in the «Images Dimensions» window.
    • Enter the desired sizes into the boxes next to «Height» and «Width.»
    • Click OK.
  3. Step 3 Export the image as an ICO file.

    When you export an image, the drop-down menu next to «Format» gives you a selection of a few different file formats to export the image as. If you hold Option and click the drop-down menu, it gives you an extended list of file formats, including the option to export the image as an ICO file for Windows icons.[3]

    • Click File in the menu bar at the top.
    • Click Export.
    • Enter a file name next to «Export as».
    • Hold the Option key and click the drop-down menu next to Format.
    • Select Microsoft Icon. Alternatively, if you wanted to make this a Mac icon, you could save the icon in the ICNS format.
    • Click Save.
  4. Advertisement

  1. Step 1 Open or create a new image file in Photoshop.

    While Photoshop won’t let you save an ICO file, you can use it to create your icon as a PNG or JPEG and then convert it to ICO with an online converter. You can open or create a new file at any time in Photoshop by clicking File in the menu bar at the top, followed by New or Open.

    • If you are creating a new image file, you will be asked to select the dimensions. The dimensions of an ICO file are typically 32 x 32 pixels, but start with 256 x 256 if you want to work with a bigger canvas. Larger images can scale down to smaller image sizes, but small image sizes cannot be enlarged without the image looking pixelated and distorted.
    • Make sure you use RGB color mode in Photoshop, not CMYK.
  2. Step 2 Resize the image to the size of an icon (if needed).

    If you opened an existing file, you may need to resize the image to be the size of an icon. Icons are typically 32×32, but they can range in size from 16 x 16 to 256 x 256.

    • Click Image in the menu bar at the top.
    • Select «Pixels» in drop-down menus next to «Width» and «Height.»
    • Enter the size of the image in the boxes next to «Width» and «Height.»
    • Click OK.
  3. Step 3 Save the image as a PNG file.

    This common file type is easy to convert to ICO. If your icon has a transparent background, the PNG file format will preserve it.

    • Go to File > Save a Copy.
    • Select PNG and give the file a name that ends with the .png file extension.
    • Click Save.
  4. Step 4 Use ICOConvert to convert the PNG to an ICO file.

  5. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

Thanks for submitting a tip for review!

References

About This Article

Article SummaryX

1. Open https://www.icoconverter.com.
2. Click Choose File.
3. Select an image.
4. Drag over the image preview to crop the image.
5. Click a style(s) to select that style for the image.
6. Select the image format you want to use (i.e Icon for Windows, Favicon for websites, multi-size file).
7. Click Convert ICO.
8. Click Download your icon(s).

Did this summary help you?

Thanks to all authors for creating a page that has been read 234,847 times.

Is this article up to date?

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Сколько делать диск с для windows 10
  • Как переместить профиль пользователя на другой диск windows 10
  • Etoken pro 4254 драйвер windows 10
  • Setup cannot continue this program requires that you have windows 8
  • Не запускается персонализация windows 10