PictureSharp.Heif 0.7.0

dotnet add package PictureSharp.Heif --version 0.7.0
                    
NuGet\Install-Package PictureSharp.Heif -Version 0.7.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="PictureSharp.Heif" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PictureSharp.Heif" Version="0.7.0" />
                    
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.7.0
                    
#r "nuget: PictureSharp.Heif, 0.7.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.
#:package PictureSharp.Heif@0.7.0
                    
#: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.7.0
                    
Install as a Cake Addin
#tool nuget:?package=PictureSharp.Heif&version=0.7.0
                    
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.9.0+.

dotnet add package PictureSharp.Heif --version 0.7.0

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.

Keep deeper samples

using Image photo = Image.Load("photo.heic", new DecoderOptions { PreserveBitDepth = true });
photo.SaveAsHeic("edited.heic", new HeifEncoderOptions { BitDepth = HeifBitDepth.Ten });

Main 10 files load into 16-bit Rgba64 storage. Saving uses up to 10-bit HEVC and remains lossy. Default loading stays 8-bit. Version 0.7.0 explains the depth options and Photos-edit limitations.

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 and Main 10, 4:2:0 or monochrome; 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 38 10/28/2026
0.6.11 71 10/26/2026
0.6.10 73 10/23/2026
0.6.9 91 10/21/2026
0.6.8 99 10/20/2026
0.6.7 93 10/20/2026
0.6.6 89 10/19/2026
0.6.5 91 10/18/2026
0.6.4 84 10/18/2026
0.6.3 87 10/18/2026
0.6.2 95 10/18/2026
0.6.1 84 10/18/2026
0.6.0 88 10/18/2026
0.5.0 93 10/17/2026

0.7.0 supports 16-bit images of PictureSharp 0.9.0: with DecoderOptions.PreserveBitDepth, HEIC coded with more than 8 bits (and such gain maps) decodes to Rgba64; HeifEncoderOptions.BitDepth (HeifBitDepth Auto, UpTo8, Ten) writes 16-bit images as HEVC Main 10. HeifEdits render 8-bit images. Requires PictureSharp 0.9.0. 8-bit output is unchanged. Notes: https://github.com/art-ix/PictureSharp.Heif/blob/v0.7.0/docs/releases/release-0.7.0.md