ICNS (.icns)

Background & Context

    • Macintosh icons format.
    • Raster image file format.
    • ICNS is an acronym derived from icon.
    • Binary format.
    • Can store multiple icons at different color resolutions.
    • Supports alpha channels.

Import & Export

  • Import["file.icns"] imports an ICNS file, returning all icons stored in the file as a list of Image objects.
  • Import["file.icns",elem] imports the specified element from an ICNS file.
  • The import format can be specified with Import["file","ICNS"] or Import["file",{"ICNS",elem,}].
  • Export["file.icns",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
  • Import by default uses the "ImageList" element for ICNS files.
  • Advanced Import elements:
  • "BitDepth"number of bits used to represent each color channel
    "Channels"the number of color channels used in the file
    "ColorSpace"color encoding used in the file
    "ImageCount"number of frames in ICNS
    "ImageSize"raster dimensions
    "Summary"summary of the file
    "SummarySlideView"slide-view summary of all frames
  • Export accepts Image and Graphics of dimensions 512×512, 256×256, 128×128, 48×48, 32×32, and 16×16. An image or graphics object not at one of the standard dimensions will be scaled so that its longest dimension fits the closest standard dimension.


open allclose all

Basic Examples  (3)

Read an ICNS file representing an icon at various resolutions:

Summary of an image:

Summary slide view for a multiframe ICNS file:

Export a list of images at various resolutions to ICNS:

Scope  (1)

Export automatically scales the image to the closest standard dimension:

Import the ICNS file containing the scaled icon:

Import Elements  (15)

Available Elements  (3)

List of all available elements:

Import all elements as a list of rules:

Import some image options:

The "Options" element does not return all of the options that present in the imported image:

Data Representation  (5)

"Data"  (1)

Get the array of color values for each icon:

Construct images of the proper type:

"Graphics"  (1)

Import as a Graphics object:

"GraphicsList"  (1)

Get the list of graphics objects:

"Image"  (1)

Import as an Image object:

"ImageList"  (1)

Get all icons, given as a list of Image objects:

This is the default import element for ICNS:

Metadata  (7)

"BitDepth"  (1)

Get the number of bits used for representing each color channel for all frames:

"Channels"  (1)

Get the number of image channels:

"ColorSpace"  (1)

Get the color encoding used on export:

Use ImageColorSpace to get the color space of an imported image:

"ImageCount"  (1)

Get the number of images stored in the file:

"ImageSize"  (1)

Get the dimensions of the images stored in the file:

Using ImageDimensions on an imported image gives the same result:

"Summary"  (1)

Get the image summary:

"SummarySlideView"  (1)

Get the summary of all images stored in the file: