PictureSharp.Heif 0.6.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package PictureSharp.Heif --version 0.6.7
                    
NuGet\Install-Package PictureSharp.Heif -Version 0.6.7
                    
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.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PictureSharp.Heif" Version="0.6.7" />
                    
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.7
                    
#r "nuget: PictureSharp.Heif, 0.6.7"
                    
#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.7
                    
#: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.7
                    
Install as a Cake Addin
#tool nuget:?package=PictureSharp.Heif&version=0.6.7
                    
Install as a Cake Tool

PictureSharp.Heif

HEIC/HEIF plugin for PictureSharp, entirely in C#.

Reads and writes HEIC on .NET 10+ with PictureSharp 0.7.6+. No native libraries or P/Invoke.

dotnet add package PictureSharp.Heif

Use

Register the format once; Image.Load, Identify, ReadMetadata and Save then handle .heic:

using PictureSharp;
using PictureSharp.Formats.Heif;

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

using var image = Image.Load("photo.heic");     // rotation, crop, alpha, ICC, EXIF and XMP applied
image.Mutate(x => x.Resize(1600, 0));
image.SaveAsHeic("small.heic", new HeifEncoderOptions { Quality = 60 });

A library can pass its own configuration through DecoderOptions.Configuration and HeifEncoderOptions.Configuration instead of changing the default.

Inside the file

An iPhone HEIC holds more than one picture: tiles, thumbnails, a depth map, mattes and an HDR gain map. HeifDocument lists them without decoding pixels:

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

using Image preview = document.LoadPreview(photo, new(320, 240));        // embedded thumbnail when one fits
using Image portrait = document.RenderPortrait(photo);                    // Portrait background blur
HeifDepthImage depth = document.LoadDepth(photo.FindDepthImage()!);       // raw depth or disparity samples
using Image map = depth.ToImage();                                         // the depth map as a greyscale image

using var withMap = Image.Load("IMG_6655.HEIC", new DecoderOptions { LoadGainMap = true });
using HdrImage hdr = withMap.ToHdr();                                     // HDR from the gain map

LivePhotoPair pair = LivePhotoPair.Read("IMG_8113.HEIC", "IMG_8113.MOV"); // Matched by ContentIdentifier

iPhone stores Portrait photos sharp and blurs them only when displaying, so a converted photo has no blur. RenderPortrait approximates the effect from the disparity map and the subject matte; it does not match Photos exactly.

Support

Read HEVC Main, Main 10 and Main Still Picture, 4:2:0 and monochrome; grids, alpha, rotation/mirror/crop, ICC and nclx, EXIF/XMP (also compressed), Apple and ISO gain maps, thumbnails, depth with Apple's description, Portrait effect, Live Photo pairing
Write HEVC Main 8-bit 4:2:0, grids, alpha, ICC/EXIF/XMP, thumbnails
Not supported image sequences, 4:2:2/4:4:4, PQ/HLG, AVIF, writing gain maps or depth, metadata editing, Portrait Lighting, Live Photo export

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

Guides: decoding · encoding · container and catalogue

0.6.7 release notes: portrait focus, hair and bokeh improvements and faster, machine-independent rendering; details with side-by-side iPhone / 0.6.6 / 0.6.7 comparisons.

0.6.6 release notes: faster HEVC decoding and encoding, with measured quality and speed comparisons.

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 95 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.7: portrait rendering calibrated against iPhone Photos exports (15 originals, 66 exports): default focus range, better outlines and hair, less foreground blur, defined point-light and night-lamp bokeh, ISO grain; background +1.07 dB and subject about +4.3 dB PSNR against 0.6.6. Rendering 2.2-3.1x faster on one thread and 2-15x with all threads, bit-identical on x64, Native AOT and ARM64. Public API unchanged. Requires PictureSharp 0.7.6. Notes: https://github.com/art-ix/PictureSharp.Heif/blob/v0.6.7/docs/releases/release-0.6.7.md