novomesk/qt-avif-image-plugin

Possible small bug with QImageReader::size

jurplel opened this issue · 7 comments

Hi again novomesk. This plugin is one of the most extensively developed I have seen, great work!
I noticed in qView that when opening an AVIF image for the first time, the size is reported as -1, -1. After the first image is opened, the correct size is reported until the program is restarted. Are you able to reproduce this, or does this make sense in your code?

Thank you for your time.

Hi,
let's investigate this together.

First, I want to ask if you have other plug-in qt-heif-image-plugin installed? Some of the old AVIF files could be non-intentionally opened via qt-heif-image-plugin (because libheif started to support AVIF too).
I know that files opened via HEIF plug-in are reported as -1 x -1 in qview.
The HEIF plug-in doesn't support the Size option. So I guess that some files are opened via HEIF plug-in and some via AVIF plug-in.

Try to uninstall the qt-heif-image-plugin if you have it to make sure the files are opened only via my qt-avif-image-plugin.

If you are still able to reproduce it, send me your example collection of AVIF testfiles and show me where you are reading the size in your code and I will try to debug.

I made following program. It opens Mexico_YUV444.avif and it should print 960x540

#include <QCoreApplication>
#include <QImage>

#include <QImageReader>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QImageReader reader("Mexico_YUV444.avif");

    if (reader.supportsOption(QImageIOHandler::Size)) {
    QSize size = reader.size();
        qWarning("%dx%d", size.width(), size.height());
    } else {
        qWarning("Size option not supported");
    }
    a.exit(0);
}

I can confirm that removing the HEIF plugin solves the issue. Excellent work, thank you so much.

You ever think about making a qt plugin based on libheif or forking qt-heif-image-plugin? I would like to see a version with as extensive support as you have here in qt-avif-image-plugin. It could support avif through libheif as well.

I was thinking that qt-heif-image-plugin needs to be improved but there are still some things to be improved in libheif.

Thank you, I will!