ximion / appstream

Tools and libraries to work with AppStream metadata
http://www.freedesktop.org/wiki/Distributions/AppStream/
GNU Lesser General Public License v2.1
210 stars 115 forks source link

Allow generating other image formats #630

Open razzeee opened 5 months ago

razzeee commented 5 months ago

Hey matthias, hope you're doing good.

With the flathub page, we're using a lot of icons and screenshots, and it would be nice to use next-gen formats.

For e.g. lighthouse test suite from google complains like this:

image

So it would be neat, to be able to generate those in addition to the "old" formats.

Cheers

ximion commented 5 months ago

This is tricky, because more formats mean more complexity and we can only have one - so all frontends need to support the format first.

I actually played around with this for a while, and jpeg-xl (jxl) yielded by far the best quality/size ratio for the kind of data we produce (it could save about 4MB for Debian's icon tarball, which is huge!). It's pretty much on-par with png, while being vastly smaller. So, I really would like to use it for both icons and well as screenshots (expanding the Freedesktop icon-theme spec in the process ideally, to just allow it globally). It being suitable for both icons (lossless) and screenshots (lossy) would make it a no-brainer.

The problem though is that webbrowsers only support it as an experimental option, if at all. And that is super annoying. There is nothing better for icons, where we want good quality, and AVIF would be nice, but only for screenshots, as AVIF's lossless mode only yielded results on-par with PNG and I also had some odd artifacts (granted though, I tested this way more than a year ago, so I guess these issues might be fixed now).

As soon as something is added, it's hard to remove, which is why I am currently a bit hesitant. If browsers would support JXL, that would be the ideal outcome, but at the moment it really doesn't look like it... So at least for screenshots, we might want to look into AVIF at some point (or WebP, which has a bit broader compatibility).

razzeee commented 5 months ago

Yeah, jpeg-xl is likely still to new for browsers https://caniuse.com/?search=jpegxl

I was wondering, why we can only have one, I guess you mean, cause the catalogue points at the images.

For the website, i wouldn't need that part, so it would already be helpful for us, if appstream could create other image formats for everything and we can set that in infra, so those images get placed too. Then I could just switch over the website, as we control the image/icon code right now.