Edit: here are the wallpapers if you want to try to reproduce my results: https://drive.proton.me/urls/3JQS48SPQR#TmgLx07up1qg. The heic is a container that includes the light and dark variant. I used magick to split it into two PNGs. I then used the PNGs to create the lossless JXLs and AVIFs.
I really like some of Apple鈥檚 wallpapers, but use Linux. Since I care about quality, I took Apple鈥檚 official wallpapers and have been converting them from heic to more Linux friendly formats.
Originally, I went for JPEG XL. Though there were two issues bothering me. First, the colors of the image noticeably changed when converting to JPEG XL, though that could an issue with the converter (I鈥檝e been using Switcheroo, though I鈥檓 not sure which backend it uses). The second issue is that JPEG XL takes longer to load images than other formats.
I then started experimenting with AVIF and had some pretty good results. First, there鈥檚 no color change. Second, at least with lossless conversion, AVIF uses significantly less space. AVIF used 15.8MB, JXL used 24.4MB, and PNG used 36.7MB. I鈥檓 not sure if it鈥檚 faster than JXL since I鈥檓 testing on different, much slower hardware at the moment.
AVIF also, seemingly, I鈥檓 not 100% sure, supports progressive decoding: https://github.com/AOMediaCodec/libavif/pull/640
> the colors of the image noticeably changed when converting to JPEG XL
I鈥檝e seen this with some embedded profiles and lossy conversions, not on lossless though. You could try removing the profile/all metadata and see if that fixes the conversion? I use the regular libjxl encoder though.I remember trying to do lossles avif but it wasn鈥檛 lossless for some reason, as for avif itself, I think it鈥檚 better for low quality stuff, but I use jxl for high qualities.
Switcheroo seems to be using libjxl for their backend, it鈥檚 listed in their cargo file: https://gitlab.com/adhami3310/Switcheroo/-/blob/main/io.gitlab.adhami3310.Converter.json?ref_type=heads
Colors shouldn鈥檛 change, sounds like something is wrong.
It also seems odd that loading jxl files would be slow, as I have heard it has excellent performance (I鈥檝e not been able to do any speed testing myself though). Though I wonder if avif is hardware accelerated.
What鈥檚 really odd is that you are getting much smaller lossless files out of avif, as pretty much every comparison I have seen shows jxl easily winning when it comes to lossless. Are you sure that you used the actual lossless mode, or did you just set the quality to maximum?
The slowness is more due to a bug in the software decoder my system is using. It has improved over the past year, but to be safe my DE reverted back to regular jpeg: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6886
I did confirm they are lossless. I used an app called Identity which lets you compare images easily. Switching between the images while at max zoom showed no change in pixels.
I also updated the post to include a drive link for the files I generated if you wanted to compare.
I played around with the big sur graphic light image. Reduced the size by 50% to make the processing easier, then ran some tests through https://squoosh.app/ I believe squoosh uses an old jxl version, but comparing it with avif in lossless mode, they were both pretty similar in size, with jxl taking a slight lead. I鈥檓 not sure why you saw such a big lead for avif on your side. A different image type might show significantly different results though. I think the multicolor gradients (and there is some noise) probably just make it difficult to compress.
Hmm, that site produces an 57.3MB lossless AVIF for the dark image compared to the 21.0MB lossless AVIF I got with Switcheroo. That鈥檚 even larger than the PNG.
One cool with JPEG XL can do is take a full quality input (no grain, but color banding), compress it (lossy or losslessy), and basically apply a grain filter on top. That鈥檚 great because the base image compresses better and the grain filter hides color banding. I wonder if AVIF has a feature like that. Unfortunately since the input has the grain, it doesn鈥檛 compress as well.
@that_leaflet I agree with the commenters there: it鈥檚 weird. I once researched image formats for a website of mine and JPEG XL showed better results in compression. It was slower (as I had to use a WASM-based decoder for browsers which not implement it), but I expected it to improve with time as long browsers implement it. But I can be biased: I used up to 1080p anime images. Also, I wanted progressive loading, which, at that time, AVIF didn鈥檛 supported.
Which makes me ponder: since AVIF now supports progressive loading, I guess I can use it in my website and avoid the WASM decoder. :ThinkCatgirl: