jakar / qt-heif-image-plugin

Qt plugin for HEIF images
GNU Lesser General Public License v3.0
65 stars 12 forks source link

Add support for AVIF #22

Closed salehqt closed 3 years ago

salehqt commented 3 years ago

AVIF is supported by latest versions of libheif. The only major change was to add avif to the detection logic.

Tested on dumageview with a few sample AVIF files:

Screenshot from 2021-06-17 17-52-47 Screenshot from 2021-06-17 17-53-27

jakar commented 3 years ago

Thanks for the PR! Why did you close it though? Is something wrong?

novomesk commented 3 years ago

AVIF support in libheif is optional. Maintainer can build libheif without AVIF decoders, only with support of HEIF/HEIC.

But the PR always declare ability to read AVIF. Problem may occur when libheif doesn't have any AV1 decoder. Qt may not attempt to open AVIF via some other plug-in (which could be installed at the same time) because the qt-heif-image-plugin already declared capability to read AVIF.

It would be good to use if (heif_have_decoder_for_format (heif_compression_AV1)) to verify if AVIF is indeed supported or not.

And I have an impression that new libheif can be built without HEIC support, so maybe it would be good to use heif_have_decoder_for_format (heif_compression_HEVC) too.

jlmxyz commented 1 year ago

Hi, I try to resurrect this patch, with the modification proposed by novomesk to verify if avif is supported by libheif

I've made some test with it, nomacs can display the image, but the gallery don't show any avif file tried with a directory with only avif files in it, when opening one of the files with nomacs, the file is displayed, and a message /some/path/to/the/file doesn't contain any image same if I embeed the files in a cbz and try to open it with qcomics.... so there is something missing (heic files does behave correctly, they are displayed into the gallery, and qcomics display a cbz with heic files in it)

edit : found the solution for nomacs, but not for qcomics.... edit2 : not sure this is related to the plugin, on nomacs, neither heic files nor avif files does display the exif data, while imagemagick' "identify -format %[EXIF:*]' file.avif does display same info than identify -format '%[EXIF:*]' file.jpg

any idea?

salehqt commented 1 year ago

There is not a lot of value in making this work since qt-avif-image-plugin exists and fullfills the need for opening avif files.

From my own work on image plugins, i know that they normally don’t return any metadata. I have been using libexiv2 to read the exif metadata separately.

jlmxyz commented 1 year ago

there are some since gentoo doen't support qt-avif-image-plugin but does support qt-heif-image-plugin in guru overlay.... even if it's cleaner to have only one plugin handling one type of file... it's more difficult to enter the "guru" team to have the qt-avif-image-plugin supported more, the avif plugin require libavif that is no required by any other dep, then forcing to install 2 libs where all other libs are already shared across other project

just solved all the issues, qcomic is filtering files allowed in the cbz, heic was in, avif wasn't.... so I'll do more testing while I convert my whole photo album to avif.

novomesk commented 1 year ago

qt-avif-image-plugin was removed from Gentoo's ::guru because AVIF support was added into kde-frameworks/kimageformats (use flag avif has to enabled).

jlmxyz commented 1 year ago

great, nomacs is not kde based but qt based.... same for qcomics... so kimageformats can have avif support, it won't enable it in other qt app I love the way of taking away something generic to make it specific to a solution (gnome, kde, lxde....) that won´t benefit most people

novomesk commented 1 year ago

Plug-ins from kimageformats work in all Qt applications, not only in KDE applications.

jlmxyz commented 1 year ago

but since I don't have kde installed, no application resolve kimageformats as a dependency.... and nothing link kimageformats as a QT only dependency... so nobody will figure that they have to install kimageformats... make a gogol research for avif support on gentoo, you'll find https://www.reddit.com/r/Gentoo/comments/i4z7vs/avif_support_in_gentoo/ that speak about guru, and your plugin but looking into guru don't show qt-avif-image-plugin, I was begining to rewrite the ebuild using the qt-hef-image-plugin when I noticed the presence of avif in qt-heif-image-plugin, that's why I came to fill a bug an found this thread... so 1) it's stupid to call a package kimageformats if it's a QT plugin and have nothing to do with kde..... 2) removing the qt-avif-image-plugin because the kimageformats does the same job is also stupid, because it won't resolve a search

$ emerge --search avif
WARNING: One or more repositories have missing repo_name entries:

        /var/lib/layman/gnunet-overlay/profiles/repo_name

NOTE: Each repo_name entry should be a plain text file containing a
unique name for the repository on the first line.

[ Results for search key : avif ]
Searching...

*  media-libs/libavif
      Latest version available: 0.11.1
      Latest version installed: [ Not Installed ]
      Size of files: 5,691 KiB
      Homepage:      https://github.com/AOMediaCodec/libavif
      Description:   Library for encoding and decoding .avif files
      License:       BSD-2

*  media-plugins/gimp-avif-plugin [ Masked ]
      Latest version available: 9999
      Latest version installed: [ Not Installed ]
      Size of files: 0 KiB
      Homepage:      https://github.com/novomesk/gimp-avif-plugin
      Description:   Plug-in for development GIMP 2.99.11 for loading/saving AVIF images.
      License:       GPL-3

[ Applications found : 2 ]

the avif flag is enabled on my side, but since nothing trigger a dependecy on kimageformats, I would never figured that this is a QT plugins and will activate avif support on nomacs....

jlmxyz commented 1 year ago

by the way, maybe you should mark qt-avif-image-plugin and qt-heif-image-plugin as obsolete, since they are both provided by the kimageformats QT plugins....

jakar commented 1 year ago

by the way, maybe you should mark qt-avif-image-plugin and qt-heif-image-plugin as obsolete, since they are both provided by the kimageformats QT plugins....

Didn't know about that. Thanks for mentioning it. Honestly, I don't have much time for this project, so I'm glad that there's something that might be better maintained.

salehqt commented 1 year ago

I looked at kimageformats, it might be a good option for Linux, but it is way too complicated for using in Windows and macOS applications. kimageformats has dependency on other KDE libraries and makes it difficult to compile and ship with a Qt application as it is the convention on Windows and Mac.

For that reason, I think it is worthwhile to keep qt-avif-image-plugin and qt-heif-image-plugin alive.