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 reference pages for full general information on Import and Export.
  • ImportString and ExportString support the ICNS format.

Import Elements

  • 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
  • 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.

Examples

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:

Introduced in 2012
 (9.0)
 |
Updated in 2016
 (11.0)