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

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

12 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

12 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

12 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

3 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

3 days ago