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

Fixed error saving APNG with duplicate frames and different duration times #5609

Merged
merged 4 commits into from Jul 13, 2021

Conversation

thak1411
Copy link
Contributor

@thak1411 thak1411 commented Jul 13, 2021

Resolves #5608

This issue is caused by the 'duration' variable being overwritten.

duration = encoderinfo.get("duration", 0)

After being overwritten, the duration variable is not updated.

if isinstance(duration, (list, tuple)):
encoderinfo["duration"] = duration[frame_count]

@thak1411 thak1411 changed the title Fixed round error in saving apng file Fixed round error in saving .apng file Jul 13, 2021
@dogemad
Copy link

dogemad commented Jul 13, 2021

Yes. There is a problem in that 'duration', which should be passed as an integer to the following context, is passed as a list by redefining the same variable names in lines 1062 and 1120 (if the condition: 1115 ~ 1119 is satisfied, This condition is satisfied when the same frame as the previous frame in the animated image is detected in succession.). So in this case using the round method on the list will throw an error.

@radarhere
Copy link
Member

I've created thak1411#1 with some suggestions.

@thak1411
Copy link
Contributor Author

Thank you for your suggestion. The merge is complete.

@radarhere radarhere changed the title Fixed round error in saving .apng file Fixed error saving APNG with duplicate frames and different duration times Jul 13, 2021
@radarhere radarhere merged commit 1fd0411 into python-pillow:master Jul 13, 2021
@thak1411
Copy link
Contributor Author

thanks @dogemad @radarhere !

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

Successfully merging this pull request may close these issues.

type list doesn't define __round__ method
3 participants