Not tested but you could try this path:
- given a
image::DynamicImage
you can convert it to RGB/RGBA usingDynamicImage::to_rgb8
/DynamicImage::to_rgba8
- this can then be converted to a flat byte buffer
- this is what
Pixbuf::from_bytes
takes - you should then be able to create a texture using
gtk4::Texture::for_pixbuf
This should avoid re-encoding to jpg just for it to be immediately decoded again (along with a loss in precision).
Alternatively have you tried installing the libavif-gdk-pixbuf
(Debian/Ubuntu) or avif-pixbuf-loader
(Fedora) packages? It seems they should provide system-wide support for loading AVIF images in all GTK applications.