This simple tutorial shows how to install the latest version of libheif library, for better HEIF and AVIF image formats support, in Ubuntu 24.04, 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.
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.19.x
.
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, libheif 1.18 features:
- reads images generated by iOS 18
- experimental codec plugins for VVC (vvenc/vvdec and uvg266)
- experimental codec plugin for OpenJPH (High-throughput JPEG2000)
- support ISO 23001-17 version 1 uncC minimized headers
- support ISO 23001-17 images with ‘deflate’, ‘zlib’ and Brotli compression
- heif-enc can read TIFF images
- API functions to read/write raw items and item properties
- For more, see github releases page.
NOTE: The latest libheif library now is at version 1.19.x, features tile access for high-resolution images, decode AVC images through OpenH264, see the link above for more.
Install Latest Libheif (1.19.5 updated) in Ubuntu via PPA
UPDATE: The official Ubuntu PPA for libheif seems no longer being updated!
For the more recent v1.19.5, I’ve uploaded it into this unofficial PPA for Ubuntu 20.04, Ubuntu 22.04, and Ubuntu 24.04 on amd64
, arm64
/armhf
CPU platforms.
The package here is backported from Debian upstream. However, due to outdated system libraries, some features are excluded!! And, they are:
- No kvazaar, no Rav1e/SVT AV1 encoder for Ubuntu 20.04.
- No Rav1e AV1 encoder for Ubuntu 22.04
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:ubuntuhandbook1/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 libheif-plugin-libde265
Linux Mint user need to run sudo apt update
to refresh package cache first.
As you see in last screenshot, there are some encoder/decoder plugins 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-aomenc
- libheif-plugin-dav1d
- libheif-plugin-ffmpegdec
- libheif-plugin-j2kdec
- libheif-plugin-j2kenc
- libheif-plugin-jpegdec
- libheif-plugin-jpegenc
- libheif-plugin-kvazaar (20.04 excluded)
- libheif-plugin-libde265
- libheif-plugin-rav1e (20.04 and 22.04 excluded)
- libheif-plugin-svtenc (20.04 excluded)
- libheif-plugin-x265
There are as well heif-gdk-pixbuf
for image loading, and libheif-examples
package that provides heif-convert
command (it’s no a link to heif-enc
) 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:ubuntuhandbook1/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).
After force downgrading the package, use the commands below to remove PPAs:
sudo add-apt-repository --remove ppa:ubuntuhandbook1/libheif
sudo apt install libheif1
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libheif1 : Depends: libheif-plugin-libde265 (= 1.17.6-1~ppa1~ubuntu20.04) but it is not going to be installed
Thank you for pointing out the issue.
The package in that PPA now has a dependency library available in another PPA. So, you also need to run command below to add the dependency PPA before being able to install the package:
Iphone 15 with iOS18 needs libheif 1.18+ to work. Any hope of getting this with 1.18?
The official PPA seems no longer being updated. Try this unofficial PPA.
THANK YOU! Trying to convert some iPhone images. It went, 1. that’s weird. 2. struggle, struggle, struggle, 3. found this page. 4. my images are converted.