ICO (.ico)

Background & Context

    • Registered MIME type: image/vnd.microsoft.icon
    • Microsoft Windows icon.
    • Raster image file format.
    • Native icon format on Windows.
    • ICO is an acronym derived from icon.
    • Binary format.
    • Can store multiple icons at different color resolutions.
    • Supports alpha channels.
    • Similar to CUR format.

Import & Export

  • Import["file.ico"] imports an ICO file, returning all icons stored in the file as a list of Image objects.
  • Import["file.ico",elem] imports the specified element from an ICO file.
  • The import format can be specified with Import["file","ICO"] or Import["file",{"ICO",elem,}].
  • Export["file.ico",expr] exports an image, graphics, or a list of them to an ICO file.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Data"array of color values for each icon
    "GraphicsList"list of graphics objects
    "ImageList"all icons, given as a list of Image objects
    "GrayLevels"array of normalized gray-level values
    "RGBColorArray"array of RGBColor objects for each icon
  • Import by default uses the "ImageList" element for ICO files.
  • Advanced Import elements:
  • "BitDepth"number of bits used to represent each color channel
    "ColorSpace"color encoding used in the file
    "ImageSize"raster dimensions
  • ICO supports a maximum of 256×256 pixels images. Export will scale down Image and Graphics larger than 256 pixels to fit.


Basic Examples  (3)

Import an ICO file that contains two bitmaps as a list of images:

Read an ICO file representing an icon at various resolutions:

Export a list of images at various resolutions to ICO: