ICNS (.icns)

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 and ExportImport and 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.
  • Import["file.icns",{elem,suba,subb,}] imports a subelement.
  • Import["file.icns",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","ICNS"] or Import["file",{"ICNS",elem,}].
  • Export["file.icns",expr,elem] creates an ICNS file by treating expr as specifying element elem.
  • Export["file.icns",{expr1,expr2,},{{elem1,elem2,}}] treats each as specifying the corresponding .
  • Export["file.icns",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.icns",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString supports the ICNS format.

ElementsElements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • 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 element for ICNS files.
  • Advanced Import elements:
  • "BitDepth"number of bits used to represent each color channel
    "ColorSpace"color encoding used in the file
    "ImageSize"raster dimensions
  • 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.

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Read an ICNS file representing an icon at various resolutions:

In[1]:=
Click for copyable input
Out[1]=

Import image resolutions of the icons:

In[1]:=
Click for copyable input
Out[1]=

Export a list of images at various resolutions to ICNS:

In[1]:=
Click for copyable input
Out[1]=

Export automatically scales the image to the closest standard dimension:

In[1]:=
Click for copyable input
Out[1]=

Import the ICNS file containing the scaled icon:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 2012
(9.0)