linuxmint / xviewer

A generic Image viewer
GNU General Public License v2.0
75 stars 37 forks source link

JPEG XL support #162

Open veikk0 opened 2 years ago

veikk0 commented 2 years ago

Based on JPEG XL's compression efficiency, encoding and decoding performance, and backwards compatibility features (like lossless JPEG transcoding), it seems we're finally going to have a universal image format. The file format was standardised in October 2021, and further ISO standarisation effort is ongoing; see https://en.wikipedia.org/wiki/JPEG_XL#Standardization_status.

JPEG XL support would be a great addition to xviewer. I'm looking to use JPEG XL, but even viewer support is currently rare. The only easy-to-install viewer I was able to find for Linux Mint was the gThumb Flatpak, but it's slow to start and doesn't support animated JXLs.

The reference implementation of JPEG XL is libjxl: https://github.com/libjxl/libjxl

darkshram commented 2 years ago

Borrowing my own comment from several issues in pix... Just install jxl-pixbuf-loader and you will get jxl support in pix and xviewer. Packages are available in Debian, Ubuntu, Linux Mint, Fedora, etc.

Same goes for webp, heif and avif formats. Just install webp-pixbuf-loader, heif-pixbuf-loader and avif-pixbuf-loader packages from your distribution software repositories.

mars4science commented 2 years ago

@darkshram , hi! I"m on Linux Mint 20.2. apt-get update; apt-get install jxl-pixbuf-loader says "E: Unable to locate package jxl-pixbuf-loader". How to install them? TIA

darkshram commented 2 years ago

https://github.com/libjxl/libjxl/releases

There you will find packages for Debian/Ubuntu. Mint is based on Ubuntu, so you may prefer the Ubuntu ones.

You may also try to build and install libxjl from source.

mars4science commented 2 years ago

@darkshram , thanks. I still wonder why they are not available in the repos. Can users realistically facilitate the process of inclusion? Maybe even included in LM distro ISO from the start? TIA

darkshram commented 2 years ago

A few days ago I opened an issue at the pix repository asking to add the pixbuf-loaders as soft or hard dependencies for pix. This means installing pix would require to install or at least recommend to install the pixbuf-loaders required to view webp, jpeg200, jxl, raw, heif, etc.

https://github.com/linuxmint/pix/issues/152

puroh commented 2 years ago

hi, i find this repository, in my case work in linux mint 20.3

sudo add-apt-repository ppa:krifa75/eog-ordissimo

Then, update your system's package list using APT.

sudo apt update

Next, install the library by running:

sudo apt install webp-pixbuf-loader

clefebvre commented 1 year ago

Alright. This might happen in Mint 21.2.. the latest libjxl was just out yesterday, Ubuntu lunar is at 0.7 right now, though I don't yet see a gdkpixbuf loader in their library.

On our side we're going to wait a little bit until the dust settles and Ubuntu/Debian get a chance to package this the way they want. Then we'll need to do the following:

I don't want to do this right now because I can't really predict how this will be packaged in Debian/Ubuntu. I don't want to do things differently and introduce differences between the distros.

mtwebster commented 8 months ago

Update - according to this bug report, it doesn't look like we'll get the pixbuf loader for a while yet (this is what xviewer, other programs need to load these files), unless we package it ourselves.

There's a djxl utility, part of libjxl-tools (which will be available in Mint 22), which would allow us to create a thumbnailer, but it would probably be quite slow compared to if we had the pixbuf loader - we'd have to extract an image with this tool, then resize it afterward.

edit: Pix (our photo editor) will have jxl support in the next release.

mruncreative commented 1 month ago

Jxl support in Pix works very well on Mint 22 but not in Xviewer and there are no thumbnails in Nemo.

mtwebster commented 1 month ago

Install xapp-jxl-thumbnailer for nemo thumbnails. No support available yet for Xviewer, unfortunately.

mruncreative commented 1 month ago

xapp-jxl-thumbnailer version 1.2.5 is already installed. Still no thumbnails.

mruncreative commented 1 month ago

If I look at the folder in pix with a freshly created jxl, the thumbnail appears. If I refresh in nemo the thumbnail appears there too. If I then refresh again (F5), it disappears from Nemo and once I switch folders and back it disappears from Pix too and won't come back in both applications no matter what.

Actually why are they cached at all? I thought you could make thumbnails for jxl images on the fly from the first x bytes because almost all jpeg xl files are progressive.

mtwebster commented 1 month ago

Thanks for establishing some reproducibility - I'll have a look at that.

We cache thumbnails because any image formats that aren't natively supported by nemo require running an external program to generate an image - this is a lot more work than loading a native .png every time. Besides, these external programs need to output a file anyhow for nemo to load. Why not keep it around?

mruncreative commented 1 month ago

Because it's a lot of duplicate data.

require running an external program to generate an image

The decoder could be integrated. I'm not sure to how much data you need to generate a thumbnail from a file though.

mtwebster commented 1 month ago

The 'decoder' is the pixbuf loader that isn't available yet. This will eliminate having to use a thumbnailer script, but is still going to be slower than loading an already-generated image that's already the correct size. Which is what the cache is for.

mruncreative commented 4 weeks ago

Today I tried again and it wouldn't generate a thumbnail at first, so I closed Nemo and opened the folder in pix and saved to a new jxl file again and it would display. I think Pix generates the thumbnails correctly and Nemo fucks them up.