Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open .heic bitmap file in SkiaSharp

Tags:

c#

skiasharp

Using C# and SkiaSharp I want to open a .heic bitmap image. My goal is to convert the .heic file to a .png or .jpg.

I have tried the following code:

SKBitmap bmp = SKBitmap.Decode(filePath);

When the filePath is to a .heic file it returns null. When the filePath is to e.g. a .jpg or .png it works fine. But I need to open .heic files.

Alternatively, are there other ways in C# to convert .heic files to .png or .jpg?

like image 585
Rask Avatar asked Oct 27 '25 23:10

Rask


1 Answers

It seems that in current version (v1.68.1.1) of SkiaSharp .heic really just isn't supported.

The alternative way is to use ImageMagick.Net which is available as a Nuget package.

It is used as follows:

using (MagickImage bmp = new MagickImage(inpath))
{
   bmp.Write(outpath, MagickFormat.Jpg);
}

If anyone knows how to get SkiaSharp to support .heic, please say so.

like image 171
Rask Avatar answered Oct 29 '25 12:10

Rask



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!