Ahmet Oğuz Koca

Ex CTO, Startup Mentor, 🏃 + 🏀

Convert HEIC files to JPG or PNG with c#

Last week I had to convert the image files with heic extension on my iPhone to jpg. After researching for a few hours, I learned that the best and cheapest way is to do it myself.

First, we include Magick.NET-Q16-AnyC library in our project via nuget. https://github.com/dlemstra/Magick.NET

Then we take all heic files in the relevant directory and convert them to jpg.

using ImageMagick;

 foreach (var item in Directory.GetFiles(@"D:\Apple\105APPLE\", "*.HEIC"))


                using (MagickImage image = new MagickImage(item))


                    var finfo = new FileInfo(item);

                    // Save frame as jpg

                    image.Write(@"d:\apple\images\" + finfo.Name.Replace(".HEIC", ".jpg"));

                    //    image.Write(@"d:\apple\images\" + finfo.Name.Replace(".HEIC", ".png"));