HEIF (.heic, .heif)

Background & Context

    • MIME type: image/heic, image/heif, image/heic-sequence, image/heif-sequence
    • HEIF raster image and compression format.
    • Commonly used for storing still or animated images.
    • HEIF is an acronym for High Efficiency Image File Format.
    • Binary format.
    • Supports grayscale and RGB color spaces.
    • Supports up to 16 bits per color channel.
    • Uses a lossy compression based on discrete cosine transform with varied block sizes.
    • Supports different compression levels.
    • Developed by Moving Picture Experts Group (MPEG).
    • Published as international standard ISO/IEC 23008-12.

Import

  • Import["file.heic"] imports an HEIF file, returning an image.
  • Import["file.heic",elem] imports the specified element from an HEIF file.
  • The import format can be specified with Import["file","HEIF"] or Import["file",{"HEIF",elem,}].
  • On Windows, the HEVC codec should be manually installed.
  • See the reference pages for full general information on Import.
  • ImportString supports the HEIF 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 pixel values
    "EmbeddedThumbnail"embedded thumbnail
    "Graphics"raster image, given as a Graphics object
    "Image"raster image, given as an Image object
    "Thumbnail"small thumbnail version of the image
    {"Thumbnail",size}thumbnail using the specified size
  • For multiframe HEIF files, the following elements can access different frames and their properties:
  • "EmbeddedThumbnailList"a list of embedded thumbnails
    "GraphicsList"a list of graphics
    "ImageCount"number of stored frames
    "ImageList"a list of images
    "ThumbnailList"a list of thumbnail images
  • Import by default uses the "Image" element for the HEIF format.
  • Advanced Import elements:
  • "BitDepth"bits used to represent each color channel in the file
    "Channels"
  • the number of color channels used in the file
  • "ColorProfileData"embedded color profile, given as a ColorProfileData object
    "ColorSpace"color encoding used in the file
    "EmbeddedThumbnailSize"size of the embedded thumbnail
    "ImageSize"raster dimensions
    "Summary"
  • summary of the file
  • "SummarySlideView"slide view summary of all frames

Options

Examples

open allclose all

Basic Examples  (2)

Import an HEIF image as an image:

Summary of an image:

Scope  (2)

Import the image as graphics:

Import the image size:

Import Elements  (13)

Available Elements  (3)

List of available elements:

Get image-related information as a list of rules:

Import some image options:

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

Data Representation  (4)

"Data"  (1)

Import the image data:

Create an image from imported data:

"Graphics"  (1)

Import as a Graphics object:

"Image"  (1)

Import as an Image object:

This is the default import element for HEIF:

"Thumbnail"  (1)

Import a thumbnail of an image:

Specify the thumbnail size:

Metadata  (6)

"BitDepth"  (1)

Get the bit count for the representation of each color channel:

"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 frames stored in the file:

"ImageSize"  (1)

Get the dimensions of the image stored in the file:

Using ImageDimensions on an imported image gives the same result:

"Summary"  (1)

Get the image summary:

Import Options  (2)

ImageSize  (1)

By default, images are imported in their full resolution:

Specify the raster size of the imported HEIF image:

"ImageTopOrientation"  (1)

By default, images are imported with the native orientation stored in the file:

Specify the side that is supposed to be on the top:

The correct orientation can also be achieved by rotating the image to be upright:

Introduced in 2020
 (12.1)