Categories: Ubuntu

How to Install Latest libheif to handle HEIF/AVIF in Ubuntu 22.04/20.04

This simple tutorial shows how to install the latest version of libheif library, for better HEIF and AVIF image formats support, in Ubuntu 22.04 and/or Ubuntu 20.04 LTS.

Libheif is a popular free open-source library for encoding and decoding HEIF and AVIF. Which, also has partial support for JPEG-in-HEIF, JPEG2000, uncompressed (ISO/IEC 23001-17:2023) capabilities.

It supports libde265 and/or ffmpeg for decoding HEIC images, and x265/kvazaar for encoding. For AVIF images, it uses either AOM/dav1d for decoding, and AOM/rav1e/svt-av1 for encoding support.

As well, it has command line tools to convert HEIF/HEIC to other images, and convert images to HEIF/HEIC.

Sponsored

Many popular applications, including GIMP, Darktable, ImageMagick, Krita, and gThumb, use libheif for HEIF and/or AVIF support. And, the library is usually installed as dependency along with them.

gThumb use libheif for AVIF support

However, libheif in Ubuntu system repositories is always old! While it has 1.6.1 (for 20.04) and 1.12.0 (for 22.04), the latest release is now 1.17.6 and keeps moving.

So, if you want to use the library for new encoders/decoders, improved performances, and bug-fixes. Or, you just run into issue with current version. Then, installing the latest version is a good choice before reporting or asking for help!

And, with the latest release (1.17.6) so far, you’ll get following new features:

  • SVT-AV1 encoder for AVIF.
  • Support for HEIFv2 regions (rgan) and user annotations (udes).
  • heif-convert to set the PNG compression level,
  • jpegdec, jpegenc codecs for JPEG in HEIF
  • ffmpeg decoder (HEIC) decoding with potential hardware decoder support
  • j2kdec, j2kenc codecs for JPEG-2000 in HEIF.
  • For more, see github releases page.

Install Latest Libheif in Ubuntu via PPA

The library has an official Ubuntu PPA, so far support current Ubuntu LTS (22.04 & 20.04) on amd64 (Intel/AMD) and arm64/armhf (e.g., Raspberry Pi) CPU architecture types.

1. First, press Ctrl+Alt+T key combination on keyboard to open terminal. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:strukturag/libheif

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

2. Then, you can either use Software Updater (Update Manager) to upgrade your current library to the latest:

Or, run command in terminal to install/upgrade it:

Sponsored
sudo apt install libheif1

Linux Mint user need to run sudo apt update to refresh package cache first.

As you see in last screenshot, there are some encoders/decoders NOT installed by default. Run sudo apt install plus the package name to install as you want.

At the moment, the plugins (encoder/decoders) include:

  • libheif-plugin-aomdec
  • libheif-plugin-j2kdec
  • libheif-plugin-libde265
  • libheif-plugin-aomenc
  • libheif-plugin-j2kenc
  • libheif-plugin-svtenc
  • libheif-plugin-dav1d
  • libheif-plugin-jpegdec
  • libheif-plugin-x265
  • libheif-plugin-ffmpegdec
  • libheif-plugin-jpegenc

There are as well heif-gdk-pixbuf for image loading, and libheif-examples package that provides heif-convert command to convert HEIC/HEIF image to other formats, and heif-enc to convert image to HEIC/HEIF.

Uninstall:

For any issue, you may purge the Ubuntu PPA, so to remove PPA repository, and downgrade all installed packages to the stock versions in system repository.

To do so, first open terminal (Ctrl+Alt+T) and run command to install ppa-purge tool:

sudo apt install ppa-purge

Then, purge the PPA (as well as downgrade packages) via command:

sudo ppa-purge ppa:strukturag/libheif

Tips: the ppa-purge may fail if you did something to PPA or the installed packages before purging. In the case, try installing synaptic package manager (from Ubuntu Software), then use it to search & force libheif1 package to old version (select the package, then press Ctrl+E).

The post How to Install Latest libheif to handle HEIF/AVIF in Ubuntu 22.04/20.04 appeared first on Osgrove.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago