Class HeicImage
Reads the images a HEIC file holds besides the one Load gives: thumbnails, depth maps, gain maps and other auxiliary images, such as an iPhone's portrait and sky mattes. Items lists them.
public static class HeicImage
- Inheritance
-
HeicImage
- Inherited Members
Examples
// The other images a photo holds: thumbnails, gain maps, depth maps and mattes (portrait, skin, sky).
HeicDetails details = (HeicDetails)sdr.Metadata.FormatDetails!;
HeicItem sky = details.Items.First(i => i.AuxiliaryType == "urn:com:apple:photo:2020:aux:semanticskymatte");
using Raster matte = HeicImage.ReadItem("portrait.heic", sky.Id, context: heic);
matte.Apply(ops => ops.AutoOrient());
matte.Save("sky-matte.png");
Methods
ReadItem(Stream, uint, ReaderOptions?, EgamiContext?)
Reads image item itemId from a stream; see ReadItem(string, uint, ReaderOptions?, EgamiContext?).
public static Raster ReadItem(Stream stream, uint itemId, ReaderOptions? options = null, EgamiContext? context = null)
Parameters
streamStreamThe file's data, from its start.
itemIduintThe item's id.
optionsReaderOptionsThe general options; the frame range is ignored.
contextEgamiContextThe context, or null for Default. Egami.Heic reads the item whether or not the context registers it.
Returns
- Raster
The image. The caller must dispose it.
Examples
// The other images a photo holds: thumbnails, gain maps, depth maps and mattes (portrait, skin, sky).
HeicDetails details = (HeicDetails)sdr.Metadata.FormatDetails!;
HeicItem sky = details.Items.First(i => i.AuxiliaryType == "urn:com:apple:photo:2020:aux:semanticskymatte");
using Raster matte = HeicImage.ReadItem("portrait.heic", sky.Id, context: heic);
matte.Apply(ops => ops.AutoOrient());
matte.Save("sky-matte.png");
Exceptions
- ArgumentException
The file has no such item, or it is not an image item.
- CorruptDataException
The data breaks the format's rules, including data of another format.
- UnsupportedFormatException
The item uses something Egami.Heic does not decode.
ReadItem(string, uint, ReaderOptions?, EgamiContext?)
Reads image item itemId (see Items): an hvc1 item or a grid, converted with its
own color into its natural pixel type, as Load converts the primary image; its own clean aperture is cropped, and its own
rotation and mirroring are given as the orientation (AutoOrient applies them).
public static Raster ReadItem(string path, uint itemId, ReaderOptions? options = null, EgamiContext? context = null)
Parameters
pathstringThe file.
itemIduintThe item's id.
optionsReaderOptionsThe general options; the frame range is ignored.
contextEgamiContextThe context, or null for Default. Egami.Heic reads the item whether or not the context registers it.
Returns
- Raster
The image. The caller must dispose it.
Examples
// The other images a photo holds: thumbnails, gain maps, depth maps and mattes (portrait, skin, sky).
HeicDetails details = (HeicDetails)sdr.Metadata.FormatDetails!;
HeicItem sky = details.Items.First(i => i.AuxiliaryType == "urn:com:apple:photo:2020:aux:semanticskymatte");
using Raster matte = HeicImage.ReadItem("portrait.heic", sky.Id, context: heic);
matte.Apply(ops => ops.AutoOrient());
matte.Save("sky-matte.png");
Exceptions
- ArgumentException
The file has no such item, or it is not an image item.
- CorruptDataException
The data breaks the format's rules, including data of another format.
- UnsupportedFormatException
The item uses something Egami.Heic does not decode.