How to view and convert HEIC images in Linux (Kubuntu)

Updated: January 10, 2025

Here's an interesting little problem. A friend of mine gave me an older iPhone 11, so I could play with it, test its long-term abilities, do all sorts of everyday checks, and whatnot. I've already written some on this endeavor, including, for instance, how to use KDE Connect for music transfer. Next, I snapped a few photos with the camera, and I didn't notice that these were taken in the rather funny HEIC format.

I tried to view these files on my Slimbook Executive, which runs Kubuntu 22.04, and I had no success. So I did some reading, installed a few packages, and eventually got around the issue, relatively easily, to be fair. However, since the resolution has several layers, let me tell you all the different aspects of this adventure. Follow me.

Problem in more detail

Technically, you can avoid the issue by changing the format that your iPhone uses to save photos. Go to Camera settings, Formats, and change High Efficiency to Most Compatible. From now on, you will get JPEG format, and you won't have any difficulty opening them.

iPhone format

Now, as it happens, if you use Kubuntu (well, Ubuntu), like me, your ability to open HEIC files will depends on several factors. Namely:

Here's the set of errors you get when you try to open an iPhone-created HEIC photo. For some reason, Kubuntu wanted to view this in Okular. But then, GwenView also throws an error. I simply wasn't able to get the images to show in any image viewer.

Okular error

GwenView error

At the end of the day, I realized I should do an image conversion. Indeed, you can use ffmpeg to convert the images, alas, this also depends on your software version:

ffmpeg -i image.heic image.png

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x649cc388f4c0] moov atom not found
IMG_0022.heic: Invalid data found when processing input

Lastly, there's also heif-convert, which should do the trick, and you ought to get it with the libheif1 package, alas, this wasn't the case for me. I had to obtain the conversion tool using a different package. Not a biggie, but it does highlight the somewhat raw, wild nature of this issue.

Solution

We want the heif-convert utility, and it comes in the heif-examples package:

sudo apt install libheif-examples

And then:

heif-convert [heic] [notheic].jpg

For example:

heif-convert IMG_0022.heic notheic.jpg
File contains 1 images
Written to notheic.jpg

And that's it. If you have multiple files, you could try a little for loop.

Conclusion

This isn't a big, critical problem, and you can work around it quite easily. If you wish to snap HEIC photos on your iPhone, at the very least, you can then convert them to other formats on your Linux machine using the heif-convert utility. You might also be using a specific distro release/version that supports the format natively. For me, on Kubuntu 22.04, the conversion utility did the trick, and it's part of the appropriately named examples package.

I would recommend not using HEIC if you don't need to. If you must, then you can do post-processing as you see fit. That will allow you to enjoy the best of all worlds, using the fancy image container for special use uses, and the widely supported JPEG for everything else. That would be all. And, I shall soon report on some more testing with this five-year-old iPhone. Take care.

Cheers.