PictureSharp.Heif
0.6.8
See the version list below for details.
dotnet add package PictureSharp.Heif --version 0.6.8
NuGet\Install-Package PictureSharp.Heif -Version 0.6.8
<PackageReference Include="PictureSharp.Heif" Version="0.6.8" />
<PackageVersion Include="PictureSharp.Heif" Version="0.6.8" />
<PackageReference Include="PictureSharp.Heif" />
paket add PictureSharp.Heif --version 0.6.8
#r "nuget: PictureSharp.Heif, 0.6.8"
#:package PictureSharp.Heif@0.6.8
#addin nuget:?package=PictureSharp.Heif&version=0.6.8
#tool nuget:?package=PictureSharp.Heif&version=0.6.8
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
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
Portrait blur and Photos edits
iPhone stores a Portrait photo sharp and blurs the background only on display, and Photos keeps the edits of its "Adjust" sliders in its library, so a converted photo has neither. Two approximations fitted to Photos exports bring them back:
using Image portrait = document.RenderPortrait(photo); // blur from the disparity map and matte
using Image edited = HeifPhotosEdit.Render(portrait, new HeifPhotosAdjustments { Brightness = 25, Warmth = 10 });
The slider values are not stored in a readable form, so the application supplies them. Neither result matches 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, Live Photo pairing |
| Write | HEVC Main 8-bit 4:2:0, grids, alpha, ICC/EXIF/XMP, thumbnails |
| Render (approximate) | Portrait background blur, the 15 Photos "Adjust" sliders |
| Not supported | image sequences, 4:2:2/4:4:4, PQ/HLG, AVIF, writing gain maps or depth, metadata editing, Portrait Lighting, Photos filters and crop, 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.8 release notes: Photos adjustment sliders.
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 | Versions 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. |
-
net10.0
- PictureSharp (>= 0.7.6)
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 | 64 | 10/28/2026 |
| 0.6.11 | 94 | 10/26/2026 |
| 0.6.10 | 94 | 10/23/2026 |
| 0.6.9 | 92 | 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.6.8: HeifPhotosEdit re-applies the 15 sliders of the Apple Photos "Adjust" panel (HeifPhotosAdjustments, on the Photos scale) to a decoded photo, fitted to 94 Photos exports of three scenes; warmth, tint, vignette, brightness and contrast close, exposure, sharpness and noise reduction rough. About 0.2 s for 12 MP (1 s with detail filters), independent of the thread count. Adds public API; existing API unchanged. Requires PictureSharp 0.7.6. Notes: https://github.com/art-ix/PictureSharp.Heif/blob/v0.6.8/docs/releases/release-0.6.8.md