Friday, March 1, 2024
HomeHow toHow to Install Latest libheif to handle HEIF/AVIF in Ubuntu 22.04/20.04

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.

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:

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).

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here


spot_img

Most Popular