-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add APNG support #4243
Add APNG support #4243
Conversation
I've been doing some more testing and found a problem in the code for writing APNG sequences that occurs if it has to write multiple fdAT chunks in a row for one image frame. I'll try to get a fix and new tests pushed for that at some point in the next couple of days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor docs suggestions. Please could you also add release notes, linking to the docs for more info?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b166e79
to
29954ce
Compare
See python-pillow#3483 Adds support for reading APNG files and seeking through frames, and adds basic support for writing APNG files.
Includes tests for reading and writing APNG files. The tests for reading files are based on the APNG browser compatibility tests from https://philip.html5.org/tests/apng/tests.html (which is linked in the Tests section of https://wiki.mozilla.org/APNG_Specification)
[ci skip]
[ci skip] Co-Authored-By: Andrew Murray <[email protected]>
- Add changes requested by hugovk
Fixes #3483.
Changes proposed in this pull request:
Implements support for reading APNG files
seek()
tell()
can be used for accessing frames,seek()
rewinding is supportedIDAT
chunks without anfcTL
chunk),im.info["default_image"]
will be set andTrue
, and the default image can still be accessed as frame 0 (seek(0)
).In this case, the first animation frame will be at
seek(1)
, andn_frames
will contain the number of frames plus 1 to account for the default image.im.info["default_image"]
is not present or isFalse
it means the APNG did not contain a separate default imageim.is_animated
will always beTrue
for APNG files, even if the animation only contains a single frame, to differentiate single frame APNG files from standard PNG files.Implements partial support for writing APNG files
save_all
andappend_images
(same behavior as writing GIF sequences)disposal
andblend
parametersappend_frames
sequence are expected to be the same size as the initial image, frame bounding box is calculated based on the differences between a given frame and the prior frameTests are based on the browser compatibility tests from https://philip.html5.org/tests/apng/tests.html, which are the only tests currently listed at: https://wiki.mozilla.org/APNG_Specification