Wednesday, July 17, 2024
HomeHow toEnable JPEG-XL (.jxl) Image Support in Ubuntu 24.04 & 22.04

Enable JPEG-XL (.jxl) Image Support in Ubuntu 24.04 & 22.04

This tutorial shows how to enable .jxl file support for system image viewer, GIMP, and some other apps in Ubuntu 24.04, Ubuntu 22.04, Ubuntu 20.04, and even Ubuntu 18.04.

JPEG-XL is a new image format by JPEG committee. It supports both lossy and lossless compression, and includes features such as animation, alpha channels, layers, thumbnails, and has better compression efficiency (60% improvement) comparing to JPEG.

For encoding and decoding JPEG-XL images, there’s a free open-source libjxl library available. Ubuntu has included the library in system repository since 24.04, however lacks GdkPixbuf loader plugin until Ubuntu 24.10 (still in development so far).

Meaning system default image viewer, and many other apps do not work with .jxl file in current 3 Ubuntu LTS releases out-of-the-box.

To enable .jxl support without rebuilding your apps, there are 2 choices so far:

  • Install libjxl .deb packages from its Github project page (Ubuntu 20.04, Ubuntu 22.04 only so far).
  • Rebuild libjxl with GdkPixbuf loader and GIMP plugin for Ubuntu 24.04.

Method 1: Install official libjxl package

Libjxl provides official .deb packages, which however supports only Ubuntu 20.04 and Ubuntu 22.04 at the moment of writing..

NOTE: Apps installed from 3rd party repositories that contain libjxl library MAY cause conflict to the official one mentioned in this method.

1. Download libjxl package

First, go to the project releases page via the link button below:

Under ‘Assets’ section, click “Show all xx assets” and select download jxl-debs... for your system. For Ubuntu 18.04, scroll down and select download the old version 0.8.2.

In case you don’t even know which system version is running, launch terminal (for Ubuntu press Ctrl+Alt+T) and run command:

lsb_release -a

For Linux Distributions based on Ubuntu or Debian, run cat /etc/os-release to tell which upstream version your system is based on.

2. Install libjxl

After downloaded the package, extract it in your file manager, finally open the extracted folder, right-click on blank area, and select “Open in Terminal“.

In pop-up terminal window, run ls to list all contained files, and run the command below to install all the deb packages:

sudo apt install ./*.deb

For choice, you may just install ‘libjxl_x.x.x_amd64.deb’, ‘libjxl-gdk-pixbuf_x.x.x_amd64.deb’, and ‘libjxl-gimp-plugin_x.x.x_amd64.deb’ as the screenshot below shows you.

After installed the packages, you can now re-open image viewer and/or image editors, and verify if they work with jxl images now.

GIMP can now export .jxl after this tutorial

Method 2: Ubuntu PPA for Ubuntu 24.04

Ubuntu 24.04 includes libjxl in system repository, though there’s no gdk-pixbuf and GIMP plugin.

Some app packages (e.g., GIMP, Krita, Darktable, and gThumb) in system repository have been built INDIVIDUALLY with that libjxl library to support JPEG-XL images.

The official libjxl package, mentioned in Method 1, is built with different package name and library files that WILL cause conflict to these app packages that depends on the one in system repository.

So, to enable JPEG-XL support for default image viewer and other graphics apps, it’s better to rebuild the system version of libjxl to support gdk-pixbuf plugin. And, to make life easier for beginners, I’ve upload it into this unofficial PPA for amd64, arm64/armhf, and i386 devices.

NOTE 1: The PPA package seems working good in my case without conflict to GIMP, Krita, gThumb, but with only minor test. Don’t use it on production machine.

NOTE 2: The source package is bigger than the system one, because of repack with bundled libraries (generated by running the script in source).

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

sudo add-apt-repository ppa:ubuntuhandbook1/jpeg-xl

Type user password (no asterisk feedback, just type in mind) when it asks and hit Enter to continue.

2. Then, run command to refresh package cache.

sudo apt update

This is done automatically while adding PPA in Ubuntu and its official flavors, but may NOT for some Ubuntu based systems, e.g., Linux Mint.

3. Finally, run command to install libjxl gdk-pixbuf and GIMP plugin:

sudo apt install libjxl-gdk-pixbuf libjxl-gimp-plugin

If you use the GIMP package from system repository, then libjxl-gimp-plugin is NOT required, since the image editor in Ubuntu 24.04 is built individually with jpeg-xl support.

4. (Optional) Since Ubuntu rarely updates the libraries in system, there’s also rarely updates in the PPA. You may remove the PPA afterwards by running command:

sudo add-apt-repository --remove ppa:ubuntuhandbook1/jpeg-xl

How to Restore

For Ubuntu 20.04 and Ubuntu 22.04, simply open terminal (Ctrl+Alt+T) and run the command below to uninstall the packages:

sudo apt remove jxl libjxl libjxl-dev libjxl-gdk-pixbuf libjxl-gimp-plugin

For Ubuntu 24.04 users installed the library from PPA, first open terminal and run command to uninstall the PPA:

sudo add-apt-repository --remove ppa:ubuntuhandbook1/jpeg-xl

Then, remove the gdk-pixbuf and GIMP plugin via command:

sudo apt remove libjxl-gdk-pixbuf libjxl-gimp-plugin

In case of removal of other apps,  instead of remove then re-install, you may downgrade libjxl0.7 package to the stock version in system repository:

sudo apt install libjxl0.7=0.7.0-10.2ubuntu6

The last command may not work if Ubuntu updates the library version. In the case, launch Synaptic package manager (install it from App Center), search and highlight the ‘libjxl’ package, finally go to ‘Package -> Force Version’ and select download to the stock version.

Downgrade libjxl



Please enter your comment!
Please enter your name here

Most Popular