PictureSharp.Heif 0.6.11

There is a newer version of this package available.
See the version list below for details.
dotnet add package PictureSharp.Heif --version 0.6.11
                    
NuGet\Install-Package PictureSharp.Heif -Version 0.6.11
                    
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="PictureSharp.Heif" Version="0.6.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PictureSharp.Heif" Version="0.6.11" />
                    
Directory.Packages.props
<PackageReference Include="PictureSharp.Heif" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PictureSharp.Heif --version 0.6.11
                    
#r "nuget: PictureSharp.Heif, 0.6.11"
                    
#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.
#:package PictureSharp.Heif@0.6.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PictureSharp.Heif&version=0.6.11
                    
Install as a Cake Addin
#tool nuget:?package=PictureSharp.Heif&version=0.6.11
                    
Install as a Cake Tool

PictureSharp.Heif

HEIC/HEIF support for PictureSharp, written entirely in C# with no native libraries. Requires .NET 10+ and PictureSharp 0.8.5+.

dotnet add package PictureSharp.Heif

Quick start

Register the format once, then load and save .heic files like any other image:

using PictureSharp;
using PictureSharp.Formats.Heif;

ImageConfiguration.Default = ImageConfiguration.Default.ToBuilder().AddFormat(new HeifFormat()).Build();

using var image = Image.Load("photo.heic");
image.Mutate(x => x.Resize(1600, 0));
image.SaveAsHeic("small.heic", new HeifEncoderOptions { Quality = 60 });

Rotation, crop, alpha, ICC, EXIF and XMP are applied when loading.

iPhone photos

An iPhone HEIC also holds a thumbnail, a depth map and an HDR gain map. HeifDocument reads them:

var document = await HeifDocument.OpenAsync("IMG_6655.HEIC");
HeifItemInfo photo = document.PrimaryImage;

using Image preview = document.LoadPreview(photo, new(320, 240));
using Image depth = document.LoadDepth(photo.FindDepthImage()!).ToImage();

using var withMap = Image.Load("IMG_6655.HEIC", new DecoderOptions { LoadGainMap = true });
using HdrImage hdr = withMap.ToHdr();

LivePhotoPair pair = LivePhotoPair.Read("IMG_8113.HEIC", "IMG_8113.MOV");

The Portrait blur and the Photos "Adjust" edits are not stored in the image itself. Render approximates both; you supply the slider values:

using Image edited = document.Render(photo, new HeifEdits
{
    Adjustments = new HeifPhotosAdjustments { Brightness = 25, Warmth = 10 },
    Portrait = new HeifPortraitOptions { Aperture = 2.8f },
});

Support

Read HEVC Main, Main 10 and Main Still Picture (4:2:0, monochrome); grids, alpha, rotation/mirror/crop, ICC and nclx, EXIF/XMP, Apple and ISO gain maps, thumbnails, depth, Live Photo pairs
Write HEVC Main 8-bit 4:2:0; grids, alpha, ICC/EXIF/XMP, thumbnails, ISO gain maps
Approximate Portrait blur, the 15 Photos "Adjust" sliders
Not supported image sequences, 4:2:2/4:4:4, PQ/HLG, AVIF, writing depth, metadata editing, Portrait Lighting, Photos filters and crop, Live Photo export

Limits, cancellation and TargetSize work as for the built-in formats. Decoded pixels match the HM reference decoder and libheif.

More: decoding · encoding · container · 0.6.10 release notes

License and patents

MIT. Ported code follows H.265, HM and kvazaar (BSD-3); see THIRD-PARTY-NOTICES.txt. libheif, libde265 and x265 are used only as test oracles. HEVC may require a patent license, which this package does not include.

Build

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 79 10/28/2026
0.6.11 98 10/26/2026
0.6.10 97 10/23/2026
0.6.9 96 10/21/2026
0.6.8 100 10/20/2026
0.6.7 94 10/20/2026
0.6.6 91 10/19/2026
0.6.5 93 10/18/2026
0.6.4 88 10/18/2026
0.6.3 90 10/18/2026
0.6.2 97 10/18/2026
0.6.1 88 10/18/2026
0.6.0 91 10/18/2026
0.5.0 98 10/17/2026

0.6.10 writes HDR gain maps: HeifEncoderOptions.GainMap (HeifGainMapMode None, Preserve, Require) saves the map attached to the image as an ISO 21496-1 tmap item, as iPhones store it, from HEIC or Ultra HDR JPEG; unedited HEIC maps are copied, others encoded at GainMapQuality. Requires PictureSharp 0.8.0. The default output is unchanged. Notes: https://github.com/art-ix/PictureSharp.Heif/blob/v0.6.10/docs/releases/release-0.6.10.md