How to Open iOS HEIC Photos or Convert to JPG/PNG in Ubuntu 20.04 | 22.04

Last updated: May 31, 2023

Got .HEIC photo images import from your iPhone? You may found that Ubuntu does not open the file format out-of-the-box.

It’s however easy to either enable this file format support or convert it to JPG or PNG image.

Enable HEIF/HEIC Support for the Default Image Viewer

In Ubuntu 20.04 and Ubuntu 22.04, you can easily enable the HEIF / HEIC file format support via libheif libraries.

1.) Simply search for and open terminal from system app launcher (or press Ctrl+Alt+T on keyboard).

2.) When terminal opens, run command to install the library:

sudo apt install heif-gdk-pixbuf

Type user password (no asterisk feedback) when it asks and hit Enter

Now, double-click to open the .heic (or right-click -> Open with Other Application -> select Image Viewer) photo and enjoy!

For Ubuntu 18.04 / Ubuntu 16.04 users, the library is not available in system repositories. You have to add the third-party PPA by running command:

sudo add-apt-repository ppa:strukturag/libheif

Then refresh package cache via:

sudo apt update

And finally run the command in step 2.) to get it installed.

Convert HEIF/HEIC to JPEG or PNG

It’s also quite easy to convert the photo to another format in Ubuntu Linux.

Simply open the photo via either GIMP or Krita image editor (both available in Ubuntu Software), then select Export to JPG / PNG.

Too many HEIC photos to convert? Using heif-convert command will be more effective.

1.) Firstly open terminal and run command to install heif-convert tool:

sudo apt install libheif-examples

2.) Next you can convert a HEIC file to JPEG via command:

heif-convert -q 85 input.HEIC output.JPG

Here -q 85 specifies the output quality level. You can skip it to use default value 92.

To batch convert HEIC photos to JPEG, firstly navigate to the photo folder in file manager and select ‘Open in Terminal’ from context menu:

Finally run command:

for file in *.HEIC; do heif-convert $file ${file%.HEIC}.jpg; done

NOTE: Linux commands are case sensitive! If your HEIC photos have file extension in lower-case, replace HEIC with heic in the last command.

For instance, convert all .HEIC photos to jpg with quality 100%, run command:

for file in *.HEIC; do heif-convert -q 100 $file ${file%.HEIC}.jpg; done

Updates for Ubuntu 22.04 LTS:

The powerful Imagemagick package in Ubuntu 22.04 repository has support the HEIC/HEIF image format!

First, press Ctrl+Alt+T on keyboard to open terminal and run command to install the tool:

sudo apt install imagemagick

Then, open the folder that contains the photo images, right-click on select “Open in Terminal” and finally use command to convert:

convert input.HEIC -quality 95 output.JPG

Change the number in -quality 95, or skip it to use default 90. To convert a batch of files (from .HEIC to .jpg), use command:

for file in *.HEIC; do convert $file ${file%.HEIC}.jpg; done

That’s all. Enjoy!

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: Buymeacoffee | https://ko-fi.com/ubuntuhandbook1 |

20 responses to How to Open iOS HEIC Photos or Convert to JPG/PNG in Ubuntu 20.04 | 22.04

  1. can you set the batch conversion quality to 100% , would appreciate an example. thanks.

    • Just add -q 100 right after heif-convert in command will do the trick. See the alert section.

  2. Hey, can you tell me why it keeps telling me ‘Unknown file type in *.JPG’? The files are all HEIC/HEIF images. Thanks!

  3. Erik from Swden October 27, 2021 at 6:44 pm

    Thanks!!

  4. use lowercase “jpg” extension

  5. This doesn’t let my 20.04 work on HIEF/HEIC.

  6. Works like a charm!

    I use: for file in *.HEIC; do heif-convert $file ${file/%.HEIC/.jpg}; done

    The only drawback: the pictures are rotated 90 degrees to the right. I used convert to rotate them back: for photo in *.jpg ; do convert $photo -rotate -90 $photo ; done

    Cheers
    Axel

  7. My .jpg files got 5 times lager in size than .heic. Something to think about if disk space is a concern.

    Cheers

  8. Thanks! I messed up a bit, but I finally made it!

  9. Tried to open heif file in gimp but responds with “failed unknown file type”
    ubuntu 20.04

  10. Hi, I get “Could not read HEIF file: Invalid input: No ‘ftyp’ box” when i try use “heif-convert IMG_0347.HEIC IMG_0347.jpg” for example. Please help me.

    • Sorry I’ve no idea why this error occurs. But imagemagick package in Ubuntu 22.04 supports converting HEIC now.

      Install it via apt command in case you don’t have it:

      sudo apt install imagemagick

      Then try convert an image via:

      convert input.HEIC -quality 90 output.jpg

      I’ll try it out in Ubuntu 20.04 and update the tutorial later.

  11. Thanks so much for the pointers.

    The instructions for Ubuntu 18.04 could be improved a bit:
    * You also need to add another repository: ppa:strukturag/libde265
    * You don’t need to run sudo apt update, since sudo add-apt-repository already includes that.

  12. Not sure if others faced this, but the HEIC images that start with IMG_E are the edits that we have done in the phone and are already jpg files, but have the .HEIC extension. I was getting that No ‘ftyp’ box” error and found help elsewhere that said those were probably jpg files and we could just rename them. I used this script and it worked:

    for file in IMG_E*.HEIC; do mv $file ${file%.HEIC}.jpg; done

    So I am running two commands in each folder to convert. I also added an rm statement in the convert script to remove the HEIC file once done:

    for file in IMG_E*.HEIC; do mv $file ${file%.HEIC}.jpg; done
    for file in *.HEIC; do heif-convert -q 100 $file ${file%.HEIC}.jpg; rm –f $file; done

    thanks for writing this up, it really helped.

  13. for file in *.HEIC; do convert $file -quality 100 ${file%}.jpg; done

  14. Does the conversion retain EXIF metadata with this tool?

  15. The png/webp in the last command is a copy/paste error obviously