I used Webp images for Qpixmap in my add-on, but it didn’t work only in MacQt6.(WebEnginView is fine, only Qpixmap does not work)
Qpixmap webp works properly on Anki-MacQt5, native PyQt6 and PyQt5 on Mac devices, Anki for Windows, Anki for Linux.(Only on Anki Qt6 for Mac does not work.)
I have tried newer and older Anki for Mac qt6 versions but not working on any of them.
Did you explicitly specify the format of the image in the QPixmap constructor or load() method? The Qt documentation says that if not specified, the format is guessed from the file header. Or, this post says it is first guessed from the file extension. In any case, if your code does not specify the format, then the format may not be guessed correctly.
Thanks for the info, I didn’t know about it so I tried this, but there seems to be no change.
pixmap = QPixmap(image_path, format='webp')
When I use QImageReader.supportedImageFormats() with MacQt6, Webp doesn’t exist, so it seems like there is no support.(but I’m not familiar with it, so I’m not exactly sure.)
This is a simple add-on to reproduce the problem (webp image will pop up when Anki starts, download the .ankiaddon file from the download icon in the upper right corner).
So I thought that only MacQt6 might not have additional plugins set up, but I have never done a build, so I don’t know much more than that.(or this info may not be relevant at all, I can only read python.)
I bundled dwebp with add-on and called it in a custom Qpixmap class with subprocess and converted it to png so I can load webp.
It is slower to load than native Qpixmap(x2 to x3), but it can support old MacQt6, so I will use it with this.(In short, if the Mac does not support webp, use dwebp, if it supports it, use the native Qpixmap.)