How to Convert HEIF Images to JPG or PNG on Linux

Convert HEIF Images to JPG or PNG on Linux

High-Efficiency Image Format (HEIF), often denoted by the file extension HEIC, is a modern image file format that offers several advantages over traditional formats like JPEG (JPG) and Portable Network Graphics (PNG). Developed by the Moving Picture Experts Group (MPEG), HEIF provides superior image quality and compression, allowing for smaller file sizes without compromising on visual fidelity. This makes HEIF an excellent choice for storing high-resolution photos on devices with limited storage capacity. However, despite its advantages, HEIF is not as widely supported as JPG and PNG. Many applications and operating systems, including some versions of Linux, may not natively support HEIF files. This can lead to compatibility issues when sharing or viewing these images. Fortunately, Linux users can convert HEIF images to more universally accepted formats like JPG or PNG using the command-line interface (CLI). This article provides a comprehensive guide on how to perform this conversion.


This guide is designed for both beginners and intermediate users of Linux. It assumes that you have a Linux operating system installed and are comfortable with using the CLI. Familiarity with basic Linux commands and file system navigation will be beneficial but is not strictly necessary.

Installing libheif

Before we can convert HEIF images, we need to install a package called libheif. This is an open-source library that provides a set of tools for reading, writing, and converting HEIF files. The installation process varies depending on your Linux distribution.

Ubuntu, Debian, and Linux Mint

On Ubuntu, Debian, and Linux Mint, you can install libheif using the apt package manager. Open a terminal and type the following command:

sudo apt update && sudo apt install libheif-examples


On Fedora, you can use the dnf package manager to install libheif. Open a terminal and type the following command:

sudo dnf install libheif

Arch Linux and Manjaro

On Arch Linux and Manjaro, you can use the pacman package manager to install libheif. Open a terminal and type the following command:

sudo pacman -S libheif

Converting HEIF Images to JPG or PNG

Once libheif is installed, you can use the heif-convert command to convert HEIF images to JPG or PNG.

Basic Conversion

The basic syntax for the heif-convert command is as follows:

heif-convert input.heic output.jpg

This command will convert the input HEIC image to a JPG image. You can replace output.jpg with output.png if you prefer to convert to PNG.

Adjusting Output Quality

The heif-convert command allows you to adjust the output quality using the -q option. The quality value can range from 0 (lowest quality, smallest file size) to 100 (highest quality, largest file size). For example, to convert a HEIC image to a JPG image with maximum quality, you can use the following command:

heif-convert -q 100 input.heic output.jpg

Batch Conversion

If you have multiple HEIC images that you want to convert, you can use a Bash for loop. The following command will convert all HEIC images in the current directory to JPG:

for i in *.heic; do heif-convert "$i" "${i%.*}.jpg"; done

Converting HEIF Images in Subdirectories

If you have HEIC images in subdirectories, you can use the find command to traverse the directories and convert the images. The following command will find all HEIC images in the current directory and its subdirectories, and convert them to JPG:

find . -name '*.heic' -exec sh -c 'heif-convert "$1" "${1%.*}.jpg"' _ {} \;


Converting HEIF images to JPG or PNG on Linux using the CLI is a straightforward process once you have the necessary tools installed. This guide has shown you how to install libheif on various Linux distributions, and how to use the heif-convert command to convert single and multiple HEIC images, adjust output quality, and traverse subdirectories. By mastering these techniques, you can ensure that your images are always in a format that is compatible with your needs.


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button