I wish that my favorite KDE applications (dolphin, gwenview, etc.) know AVIF format:
There is a library with AVIF support:
libavif needs libaom (for AV1 stream encoding/decoding) or alternatively (dav1d and rav1e).
I observed that kimageformats support various formats and each format has classes derived from QImageIOPlugin, QImageIOHandler. I believe it should be possible to write similar classes for AVIF format too.
I have some experience with libavif, I created plug-in which works with development GIMP 2.99.1 ( I attached it to case https://gitlab.gnome.org/GNOME/gimp/issues/2668 ).
What do you suggest to do?
Shall I develop the code for kimageformats and attach it here?
Thanks for considering adding support for this new format.
QImage I/O plugins are mostly self-contained, so it wouldn't really matter if you develop it as a github project, a separate KDE project, a subproject of (KDE's) kimageformats, or a subproject of (Qt's) qtimageformats.
It mostly depends on the license you plan to use. If you aim for inclusion in Qt, you have less freedom to chose the license compared to a github project, for example.
Created attachment 126421 [details]
Source code of the plugin
I am sharing initial version of my plug-in to support AVIF image format.
You need to build and install libavif first. Configure libavif to use at least one supported AV1 encoder and decoder (AOM, RAV1E, DAV1D, GAV1).
When AV1 encoders/decoders are upgraded, it is good to rebuild libavif too.
How to build:
qmake will produce Makefile,
make will produce libqavif.so
How to install:
cp libqavif.so /usr/lib/qt5/plugins/imageformats/
cp avif.desktop /usr/share/kservices5/qimageioplugins/
Associate .avif extension (use mimetype image/avif , suggested name "AV1 Image File Format (AVIF)") with gwenview (for example).
How to enable thumbnails in dolphin:
add image/avif; to the list MimeType=...
I made a new version of the plug-in.
The new version supports AVIF image sequences.
It supports colorspaces if you compile it with Qt >= 5.14
Loaded picture is automatically rotated and/or mirrored if necessary.
It is possible to make a version with libavif statically linked with the plug-in, sources + build script included. Sources of dependencies (libaom + libavif) included.
Who wants to make dynamic linking with system installed libavif, can do it too (another build script included). libavif >= 0.6.0 is required in case of dynamic linking.
I wrote in README.txt how to install the plug-in and how to make dolphin to display thumbnails with AVIF pictures.
Did you yet decide where to publish it? Do you want to maintain your own repository in github, or do you want to contribute to Qt or KDE repositories?
My plug-in is free, it can be used by closed source too.
I wish it to be included in Qt, however it's not me who can decide if/when it will be accepted.
I would consider inclusion in kimageformats (instead of Qt Image Formats) a big success too. It would bring AVIF support to large volume of applications/users and perhaps it would stimulate other software vendors to add support too.
> I wish it to be included in Qt, however it's not me who can decide if/when it will be accepted.
Did you discuss this with the Qt developers? They won't magically find out that you want to include and maintain it. You can find them at the Qt development mailing list.
(In reply to Christoph Feck from comment #6)
> Did you discuss this with the Qt developers? They won't magically find out
> that you want to include and maintain it. You can find them at the Qt
> development mailing list.
I wrote at Qt forum that I am willing to contribute the code.
They informed me about https://wiki.qt.io/Qt_Contribution_Guidelines
Those things are new for me, I feel I need to learn a lot. It will take some time to go through everything. Perhaps someone will help.
(In reply to dnovomesky from comment #7)
> Those things are new for me, I feel I need to learn a lot. It will take some
> time to go through everything. Perhaps someone will help.
I am also interested in the adoption and support of AVIF in Qt and KDE. Maybe as an alternative to the big step of getting your code into Qt directly, you may start with smaller goals such as:
- Decide under which license you software is about to be released. You mentioned that you want to allow closed-source usage, so one of the BSD-licenses is a popular choice here, for example the 3-clause BSD license 
Once you have chosen a license, put a text file called LICENSE.txt with the license's text in the source code's root directory and add comments at the beginning of each source file stating under which license it is available and who is the copyright holder (you and any potential future contributor).
- Align your build system, directory structure, and filenames to how they are in other Qt or KDE image plugins. For example, it is rather uncommon to have shell scripts like build_libqavif_dynamic.sh.
- To make your code accessible to other developers and to allow for easier contributions instead of attaching .zip files to a bug report or referring to webservers without TLS or domain name, get an account at some Git repo hoster, such as GitLab (AFAIK KDE is considering adopting the GitLab software, too). [2,3]
Good luck and happy coding!
I host the plug-in on GitHub ( https://github.com/novomesk/qt-avif-image-plugin ) as few people recommended before.
The license I use is BSD 2-Clause License ( https://aomedia.org/license/ ) - it is the same license as dependencies needed for the plug-in (libavif + libaom), nothing more above that.
I submitted AVIF mimetypes to shared-mime-info, so the AVIF will be recognized in the future:
Those shell scripts are for common users who are not programmers. The essence of the scripts is to run qmake + make.
I am open to change the file structure and the build process but I need some real examples I should follow.
We can close this. AVIF is now supported by kimageformats
*** Bug 434888 has been marked as a duplicate of this bug. ***
In Okular, using the open-file dialog, if you navigate to a folder that contains avif or webp images, the file selection dialog will not even list those file-types without the additional step of changing the filter from "All supported files" to "All files".