Comments (8)
I guess you want to test if the image is indeed animated via for example QImageReader::supportsAnimation
. In that case I could modify the code to return false in case I only detected one frame. I just want to validate that this is how you check if it's animated.
Please notice that this is a very simple png implementation, and does support all features. I recommend to fall back to qts png implementation in case you only detect one frame. And it requires libpng to be available for compilation and when running, as it cannot use the statically linked png implementation of the png plugin.
from apngproject.
The thing is: My knowledge of the png lib is rather limited, I found the implementation somewhere and adjusted it to my needs. I simply don't know how to check the headers, and currently don't have the time to read into it. Thus, I do indead read all frames. However, you are free to create a pull request for that. This goes for static linking, too. It kept it dynamic, simply to have less work.
If your fine with keeping the current approach, I can add the animation check as described before.
from apngproject.
Thank you for your cooperation.
As long as I am reading your current implementation, qapng decodes all the frames at the checking stage, so it is heavily loaded and requires a lighter checking method than checking only headers and tags.
planned implementation (extension png):
- Specify the file and call QImageReader :: supportsAnimation () to check if there is animation
- (With animation) Change to format="apng" and use QMovie
- (No animation) Do not change from format="png" and continue to use QImageReader
It is possible to statically link libpng.lib into the apng.dll plugin.
There is a policy of each developer, there are disadvantages and advantages of whether it is dll or lib, but I prefer static linking because it avoids problems.
I actually use my own qjpeg plugin which used libjpeg-turbo in the application.
However, since plugin formats provided by qt such as 'jpeg' and 'png' as standard are proprietary, we can not use with user defined plugins. In my plugin it's formatted as 'turbojpeg'.
from apngproject.
according to https://wiki.mozilla.org/APNG_Specification
The "default image" is the image described by the standard
IDAT
chunks, and is the image that is displayed by decoders that do not support APNG.
To be recognized as an APNG, an
acTL
chunk must appear in the stream before anyIDAT
chunks. TheacTL
structure is described below.
So, we only need to check the acTL chunk :)
Then it is a trivial matter whether to link libpng statically or dynamically. Usually you do not have to worry. I will change it on this side and use it.
from apngproject.
That doesn't sound too complicated... But I still wont have time for the next two weeks or so. Create a PR if you want, or wait until then. The simple update with checking the frames I can do today or tomorrow
from apngproject.
The animated check works now. Please note that it will return still "true" if no frames are detected at all (i.e. and invalid image), as this is required for Qt to detect the plugin as movie type.
from apngproject.
With the latest commit (001dd13) I rewrote the plugin to make use of the apng patch for libpng.
I case your system does not use the patched libpng version, I also added a script that downloads libpng sources + patch and compiles both to a static library, which can the be used for compilation.
With the patched apng version, the image is read sequentially, and thus only the first few bytes until the acTL chunk are read. Also, blending, autoloops and more have been improved.
I am going to clean up the code a little more and improve the reading part, and then move the apng plugin to a seperate repository. I will close this issue once this is done.
from apngproject.
And done. Have a look at https://github.com/Skycoder42/qapng. It's the refactored and improved apng plugin. Closing this issue as the plugin is no longer part of this repository. If you have further problems/suggestions, please open a new issue on the new project
from apngproject.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apngproject.