Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apng format support #280

Closed
jurplel opened this issue Apr 8, 2020 · 9 comments
Closed

apng format support #280

jurplel opened this issue Apr 8, 2020 · 9 comments
Labels
enhancement New feature or request
Milestone

Comments

@jurplel
Copy link
Owner

jurplel commented Apr 8, 2020

No description provided.

@jurplel jurplel added the enhancement New feature or request label Apr 8, 2020
@jurplel jurplel added this to the qView 4.0 milestone Apr 8, 2020
@sonulohani
Copy link
Contributor

We have apng plugin support in Qt. Here is the source code of the plugin:- https://github.com/Skycoder42/QtApng/tree/master/src/plugins/imageformats/apng

@jurplel
Copy link
Owner Author

jurplel commented May 20, 2020

Yes that is the plan.

@sonulohani
Copy link
Contributor

Hi @jurplel

I am able to load apng file successfully. I can see the png file getting animated. For that we need to compile the plugin and put that in plugins/imageformats folder in Qt SDK directory.

The problem is that QImageReader::supportsAnimation() returns false for apng file. I believe we might need to modify/add this as an issue in the plugin repository.

I thought of removing the QImageReader::supportsAnimation() with QMovie::isValid(). However, it returns true even for normal image file which doesn't have animations. So I replaced it with loadedMovie.isValid() && loadedMovie.frameCount() != 1 and this works fine.

@sonulohani
Copy link
Contributor

Here is the PR:- #325

@jurplel
Copy link
Owner Author

jurplel commented May 22, 2020

Only took a quick look at this but I have no idea how QImageReader::supportsAnimation() could not be working.

https://code.woboq.org/qt5/qtbase/src/gui/image/qimagereader.cpp.html#_ZNK12QImageReader17supportsAnimationEv

QImageReader::supportsAnimation() simply queries `supportsOption(QImageIOHandler::Animation).

https://github.com/Skycoder42/QtApng/blob/master/src/plugins/imageformats/apng/apngimagehandler.cpp#L50

supportsOption is written to return true for QImageIOHandler::Animation (unless this bit of code is invalid in a way I cannot see).

Are you using it with a .apng file extension or a .png file extension? It notes in the readme that it only works with .apng. I am guessing you probably did use an .apng file extension though because it seems to imply that it would not work whatsoever with .png.

@sonulohani
Copy link
Contributor

sonulohani commented May 22, 2020

Hi @jurplel

Yes, youre right. If you see the code changes I am explicitly setting the fomat to apng. This would not work with png files because Qt already has plugin available to support png files. The only way I would see to fix is either use our own image reader which would based on the frames count use png or apng. I will explore more on this.

@jurplel
Copy link
Owner Author

jurplel commented May 22, 2020

I have opened an issue for some of the weirdness: Skycoder42/QtApng#11

@jurplel jurplel closed this as completed Oct 18, 2020
@BLumia
Copy link

BLumia commented Jan 4, 2022

imageReader.setDecideFormatFromContent(true);

By looking at the current implementation of qView, I guess the supportsAnimation() issue is related to Skycoder42/QtApng#12 which should be fixed now :)

The size image property is still not correct but it's a different issue of QtApng IMO. (update: and this should be fixed in Skycoder42/QtApng#14)

@jurplel
Copy link
Owner Author

jurplel commented Jan 5, 2022

Oh, cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants