Convert HEIF Images to JPG or PNG on Linux (With Commands)

HEIF photos (those with the .HEIC file extension) can store image data more efficiently than JPG or PNG, which yields a smaller file size. But the glaring drawback is that HEIF doesn’t enjoy widespread support. If you have some HEIF photos that you need to convert to a different format, this can be done from the Linux command line.

In this tutorial, you’ll see how to convert HEIF images to JPG or PNG with Linux commands.

Install libheif on Linux

The heif-convert command is used to convert HEIF images to other formats. Use the appropriate command below to install the libheif package, containing the heif-convert utility, with your system’s package manager.

Ubuntu, Debian, and Linux Mint:

$ sudo apt install libheif-examples


$ sudo dnf install -y$(rpm -E %fedora).noarch.rpm
$ sudo dnf install libheif

Arch Linux and Manjaro:

$ sudo pacman -S libheif

Convert HEIF images to JPG or PNG

1. Use the following syntax with the heif-convert command to convert a photo. Simply supply the name of the input file (the HEIC photo) followed by the name of the output file (the new JPG or PNG photo).

$ heif-convert image.HEIC new-image.jpg


$ heif-convert image.HEIC new-image.png

2. The -q option will control the quality level of the output image. To keep your converted photos looking sharp, you should use the -q 100 setting to convert at maximum quality.

$ heif-convert -q 100 image.HEIC new-image.jpg

3. If you have a lot of HEIF photos to convert, you can use a Bash for loop to bulk convert hundreds or thousands of HEIC photos at once.

$ for f in *.HEIC; do heif-convert -q 100 $f $f.jpg; done

4. If you have HEIF files scattered throughout subdirectories, you can use the find command to traverse subdirectories and convert every .HEIC (or .heic) file that it finds.

$ find . -iname "*.heic" -exec heif-convert -q 100 {} {}.jpg \;

5 thoughts on “Convert HEIF Images to JPG or PNG on Linux (With Commands)”

  1. Thank you! My iPhone saves to HEIC to save space, and the website I work with won’t accept the files. This made it quick and easy!

  2. Super useful and just did it. Special mention to arch-linux support given. Just used it and awesome conversion for printing it out.
    Keep going.


Leave a Comment

Your email address will not be published. Required fields are marked *