Openize.Heic 24.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Openize.Heic --version 24.5.0                
NuGet\Install-Package Openize.Heic -Version 24.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Openize.Heic" Version="24.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Openize.Heic --version 24.5.0                
#r "nuget: Openize.Heic, 24.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Openize.Heic as a Cake Addin
#addin nuget:?package=Openize.Heic&version=24.5.0

// Install Openize.Heic as a Cake Tool
#tool nuget:?package=Openize.Heic&version=24.5.0                

Openize.Heic

Openize.Heic is an open source implementation of the ISO/IEC 23008-12:2017 HEIF file format decoder.

It is written from scratch and has a plain C# API to enable a simple integration into other software.

Supported features

Openize.Heic has support for:

  • HEIC coded static images;
    • I slices;
    • 4:2:0, 4:2:2 and 4:4:4 chroma subsampling.
  • HEIC coded animations that use several I‑slices;
  • multiple images in a file;
  • alpha channels, depth maps, thumbnails, auxiliary images;
  • correct color transform according to embedded color profiles;
  • image transformations (crop, mirror, rotate), overlay images.

Openize.Heic doesn't support:

  • HDR images;
  • reading EXIF and XMP metadata;
  • color transform according to EXIF contained color profiles;
  • HEIC coded animations that use P and B‑slices;
  • deblocking filter.

Usage examples

Read .heic file to int array with Argb32 data

using (var fs = new FileStream("filename.heic", FileMode.Open))
{
    HeicImage image = HeicImage.Load(fs);
    int[] pixels = image.GetInt32Array(Heic.Decoder.PixelFormat.Argb32);
}

Read .heic file to System.Windows.Media.Imaging.WriteableBitmap

using (var fs = new FileStream("filename.heic", FileMode.Open))
{
    HeicImage image = HeicImage.Load(fs);
     
    var pixels = image.GetByteArray(Heic.Decoder.PixelFormat.Bgra32);
    var width = (int)image.Width;
    var height = (int)image.Height;
     
    var wbitmap = new WriteableBitmap(width, height, 72, 72, PixelFormats.Bgra32, null);
    var rect = new Int32Rect(0, 0, width, height);
    wbitmap.WritePixels(rect, pixels, 4 * width, 0);
}

Documentation

All public classes, methods and properties are documented in corresponding API_README:

HeicImage

Methods
Name Type Description Parameters Notes
Load HeicImage Reads the file meta data and creates a class object for further decoding of the file contents. Stream stream - File stream. This operation does not decode pixels.<br />Use the default frame methods GetByteArray or GetInt32Array afterwards in order to decode pixels.
CanLoad bool Checks if the stream can be read as a heic image.<br />Returns true if file header contains heic signarure, false otherwise Stream stream - File stream.
Properties
Name Type Description
Frames Dictionary<uint, HeicImageFrame> Dictionary of Heic image frames with access by identifier.
DefaultImage HeicImageFrame Returns the default image frame, which is specified in meta data.

HeicImageFrame

Methods
Name Type Description Parameters
GetByteArray byte[] Get pixel data in the format of byte array.<br />Each three or four bytes (the count depends on the pixel format) refer to one pixel left to right top to bottom line by line. PixelFormat pixelFormat - Pixel format that defines the order of colors and the presence of alpha byte.<br />Rectangle boundsRectangle - Bounds of the requested area.
GetInt32Array int[] Get pixel data in the format of integer array.<br />Each int value refers to one pixel left to right top to bottom line by line. PixelFormat pixelFormat - Pixel format that defines the order of colors.<br />Rectangle boundsRectangle - Bounds of the requested area.

Properties

Name Type Description
ImageType ImageFrameType Type of an image frame content.
Width uint Width of the image frame in pixels.
Height uint Height of the image frame in pixels.
HasAlpha bool Indicates the presence of transparency of transparency layer.<br />True if frame is linked with alpha data frame, false otherwise.
IsDerived bool Indicates the fact that frame contains only transform data and is inherited from another frame.<br />True if frame is derived, false otherwise.
NumberOfChannels byte Number of channels with color data.
BitsPerChannel byte[] Bits per channel with color data.

License

Openize.HEIC is available under Openize License.

[!CAUTION] Openize does not and cannot grant You a patent license for the utilization of HEVC/H.265 image compression/decompression technologies.

Openize.HEIC uses Openize.IsoBmff that is distributed under MIT License.

OSS Notice

Sample files used for tests and located in the "./Openize.Heic.Tests/TestsData/samples/nokia" folder belong to Nokia Technologies and are used according to Nokia High-Efficiency Image File Format (HEIF) License

Licensed Field means the non-commercial purposes of evaluation, testing and academic research in each non-commercial case to use, run, modify (in a way that still complies with the Specification) and copy the Software to (a) generate, using one or more encoded pictures as inputs, a file complying with the Specification and including the one or more encoded pictures that were given as inputs; and/or (b) read a file complying with the Specification, resulting into one or more encoded pictures included in the file as outputs.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
24.6.0 1 6/10/2024
24.5.1 1 5/29/2024
24.5.0 2 5/28/2024