How to open a HEIF (.heic) image?

Jean-Milost Reymond picture Jean-Milost Reymond · Sep 13, 2017 · Viewed 11.4k times · Source

For a c++ project, I need to open and show a HEIF (.heic) image. What I know (if I'm right) is that the HEIF images are based on the ffmpeg standard, and requires a H265 codec to be read.

I found several open-source H265 codecs:

I can open and show H265 encoded video files with each of them, but I'm unable to simply open, show or convert a .heic image. All of them return an error, or just do nothing.

To be honest I'm a little puzzled, because the HEIF standard seem to be a well kept secret. I'm unable to find a relevant info that could allow me to walk to a solution. Those I found are just tricks and workarounds, like e.g. forcing the device (I'm speaking here about the Apple iPhone using the new iOS11) to generate a jpg image instead of a heic, or using a third party application like dr.fone. Of course these solutions are irrelevant for me.

So, somebody can tell me which codec I should use with a .heif image, and how I can use it to open it? Or are there open source libraries or examples that allow to manipulate this type of image file? Somebody can point me to the good direction?

Answer

Ronald S. Bultje picture Ronald S. Bultje · Sep 13, 2017

An example viewer specific for HEIF from Nokia is available here. I also tested directly with FFmpeg and it's able to open (play/decompress) the provided conformance files.