{"id":45136,"date":"2024-01-09T15:16:30","date_gmt":"2024-01-09T15:16:30","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=45136"},"modified":"2025-07-04T15:26:46","modified_gmt":"2025-07-04T15:26:46","slug":"install-latest-libheif-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/01\/install-latest-libheif-ubuntu\/","title":{"rendered":"Install libheif 1.19.8 in Ubuntu 24.04 | 22.04 for iOS 18 Support"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-45137\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon-700x700.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/photo-image-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>This simple tutorial shows how to install the latest version of libheif library, for better HEIF and AVIF image formats support, in <b>Ubuntu 24.04<\/b>, <b>Ubuntu 22.04<\/b> and\/or <b>Ubuntu 20.04<\/b> LTS.<\/p>\n<p><a href=\"https:\/\/github.com\/strukturag\/libheif\" target=\"_blank\" rel=\"noopener\">Libheif<\/a> 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.<\/p>\n<p>It supports <code>libde265<\/code> and\/or ffmpeg for decoding HEIC images, and <code>x265<\/code>\/<code>kvazaar<\/code> for encoding. For AVIF images, it uses either <code>AOM<\/code>\/<code>dav1d<\/code> for decoding, and <code>AOM<\/code>\/<code>rav1e<\/code>\/<code>svt-av1<\/code> for encoding support.<\/p>\n<p>As well, it has command line tools to convert HEIF\/HEIC to other images, and convert images to HEIF\/HEIC.<\/p>\n<p>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.<\/p>\n<div id=\"attachment_45138\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/gthumb-avif.webp\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-45138\" class=\"size-large wp-image-45138\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/gthumb-avif-700x440.webp\" alt=\"\" width=\"610\" height=\"383\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/gthumb-avif-700x440.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/gthumb-avif-300x188.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/gthumb-avif-768x482.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/gthumb-avif.webp 1129w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><p id=\"caption-attachment-45138\" class=\"wp-caption-text\">gThumb use libheif for AVIF support<\/p><\/div>\n<p><!--more--><\/p>\n<p>However, libheif in Ubuntu system repositories is always old! While it has <code>1.6.1<\/code> (for 20.04) and <code>1.12.0<\/code> (for 22.04), the latest release is now <code>1.20.x<\/code>.<\/p>\n<p>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!<\/p>\n<p>And, features in latest libheif compare to system default ones:<\/p>\n<ul>\n<li>reads images generated by iOS 18<\/li>\n<li>experimental codec plugins for VVC (vvenc\/vvdec and uvg266)<\/li>\n<li>experimental codec plugin for OpenJPH (High-throughput JPEG2000)<\/li>\n<li>support ISO 23001-17 version 1 uncC minimized headers<\/li>\n<li>support ISO 23001-17 images with &#8216;deflate&#8217;, &#8216;zlib&#8217; and Brotli compression<\/li>\n<li>heif-enc can read TIFF images<\/li>\n<li>API functions to read\/write raw items and item properties<\/li>\n<li>tile access for high-resolution images<\/li>\n<li>decode AVC images through OpenH264<\/li>\n<li>For more, see <a href=\"https:\/\/github.com\/strukturag\/libheif\/releases\" target=\"_blank\" rel=\"noopener\">github releases<\/a> page.<\/li>\n<\/ul>\n<p><b>NOTE: Update libheif from PPA repository MAY cause conflict to other third-party packages!! Use it at your own risk.<\/b><\/p>\n<h3>Install Latest Libheif (1.19.8 updated) in Ubuntu via PPA<\/h3>\n<p><b>Step 1: Add PPA:<\/b><\/p>\n<p><b>The <a href=\"https:\/\/launchpad.net\/~strukturag\/+archive\/ubuntu\/libheif\" target=\"_blank\" rel=\"noopener\">official Ubuntu PPA<\/a> has revived recently with libheif 1.19.8 for Ubuntu 20.04, 22.04, and 24.04 on <code>amd64<\/code>, <code>arm64\/armhf<\/code> platforms!<\/b><\/p>\n<p>To add the PPA, open terminal (Ctrl+Alt+T) and run command:<\/p>\n<pre>sudo add-apt-repository ppa:strukturag\/libheif<\/pre>\n<p><i>Type user password (no visual feedback) when it asks and hit Enter to continue.<\/i><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/libheif-officialppa.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49220\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/libheif-officialppa-700x475.webp\" alt=\"\" width=\"610\" height=\"414\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/libheif-officialppa-700x475.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/libheif-officialppa-300x204.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/libheif-officialppa.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>2. Then, you can either use Software Updater (Update Manager) to upgrade your current library to the latest:<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-libheif.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45140\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-libheif-700x562.webp\" alt=\"\" width=\"610\" height=\"490\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-libheif-700x562.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-libheif-300x241.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-libheif-768x616.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/upgrade-libheif.webp 804w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Or, run command in terminal to install\/upgrade it:<\/p>\n<pre>sudo apt install libheif1 heif-gdk-pixbuf heif-thumbnailer<\/pre>\n<p><i>Linux Mint user need to run <code>sudo apt update<\/code> to refresh package cache first.<\/i><\/p>\n<p><b>NOTE: If you have Ubuntu Pro enabled, then, try the command below instead to specify package source, or it MAY install the one from Ubuntu ESM.<\/b><\/p>\n<pre>sudo apt install -t \"o=LP-PPA-strukturag-libheif\" libheif1 heif-gdk-pixbuf heif-thumbnailer<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-official-libheif.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49221\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-official-libheif-700x505.webp\" alt=\"\" width=\"610\" height=\"440\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-official-libheif-700x505.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-official-libheif-300x216.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-official-libheif-768x554.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-official-libheif.webp 914w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>As you see in last screenshot, there are also some encoder\/decoder plugins available. If they are not installed, run <code>sudo apt install<\/code> plus the package name to install as you want.<\/p>\n<p>At the moment, the plugins (encoder\/decoders) include:<\/p>\n<ul>\n<li>libheif-plugin-aomdec<\/li>\n<li>libheif-plugin-aomenc<\/li>\n<li>libheif-plugin-dav1d<\/li>\n<li>libheif-plugin-ffmpegdec<\/li>\n<li>libheif-plugin-j2kdec<\/li>\n<li>libheif-plugin-j2kenc<\/li>\n<li>libheif-plugin-jpegdec<\/li>\n<li>libheif-plugin-jpegenc<\/li>\n<li>libheif-plugin-libde265<\/li>\n<li>libheif-plugin-svtenc (20.04 excluded)<\/li>\n<li>libheif-plugin-x265<\/li>\n<\/ul>\n<p>There are as well<code>libheif-examples<\/code> package that provides <code>heif-convert<\/code> command (it&#8217;s now a link to <code>heif-enc<\/code>) to convert HEIC\/HEIF image to other formats, and <code>heif-enc<\/code> to convert image to HEIC\/HEIF.<\/p>\n<h3>Uninstall:<\/h3>\n<p>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.<\/p>\n<p>To do so, first open terminal (Ctrl+Alt+T) and run command to install ppa-purge tool:<\/p>\n<pre>sudo apt install ppa-purge<\/pre>\n<p>Then, purge the PPA (as well as downgrade packages) via command:<\/p>\n<pre>sudo ppa-purge ppa:strukturag\/libheif<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/ppa-purge-libheif.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49222\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/ppa-purge-libheif-700x427.webp\" alt=\"\" width=\"610\" height=\"372\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/ppa-purge-libheif-700x427.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/ppa-purge-libheif-300x183.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/ppa-purge-libheif-768x468.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/ppa-purge-libheif.webp 786w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>NOTE: <code>ppa-purge<\/code> may fail sometimes (due to e.g., internet corruption). In the case, you may do the steps below one by one to downgrade manually:<\/b><\/p>\n<ul>\n<li>First, run command to add an apt configuration file and edit via nano command line text editor:\n<pre>sudo nano \/etc\/apt\/preferences.d\/libheif1<\/pre>\n<\/li>\n<li>When the file opens, add the line (Ctrl+C to copy, Ctrl+Shift+V to paste) below:\n<pre>Package: libheif* heif*\r\nPin: origin archive.ubuntu.com\r\nPin-Priority: 1001<\/pre>\n<p>The rules will set higher priority (1001, meaning allow to automatically downgrade) for all libheif related packages from Ubuntu repository.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/set-libheif-phigh.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49223\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/set-libheif-phigh-700x452.webp\" alt=\"\" width=\"610\" height=\"394\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/set-libheif-phigh-700x452.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/set-libheif-phigh-300x194.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/set-libheif-phigh-768x496.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/set-libheif-phigh.webp 770w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<li>After that, press Ctrl+S to save file, and Ctrl+X to exit. Then, run command to refresh cache:\n<pre>sudo apt update<\/pre>\n<\/li>\n<li>Finally, run command below will install back the old libheif libraries (meaning downgrade) from system repository.\n<pre>sudo apt install libheif1 heif-gdk-pixbuf heif-thumbnailer<\/pre>\n<\/li>\n<li>When done, remove the rule you just added:\n<pre>sudo rm \/etc\/apt\/preferences.d\/libheif1<\/pre>\n<p>Finally refresh cache <code>sudo apt update<\/code> to apply change.<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>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) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":45137,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2038,1432],"class_list":["post-45136","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-heif","tag-photo"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/45136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=45136"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/45136\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/45137"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=45136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=45136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=45136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}