Skip to content

Commit

Permalink
Merge pull request #7701 from esoma/issue-7700
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 11, 2024
2 parents 08992cf + 6f144d4 commit fc67ee2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Binary file added Tests/images/apng/different_durations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions Tests/test_file_apng.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,3 +689,12 @@ def test_different_modes_in_later_frames(mode, default_image, duplicate, tmp_pat
)
with Image.open(test_file) as reloaded:
assert reloaded.mode == mode


def test_apng_repeated_seeks_give_correct_info() -> None:
with Image.open("Tests/images/apng/different_durations.png") as im:
for i in range(3):
im.seek(0)
assert im.info["duration"] == 4000
im.seek(1)
assert im.info["duration"] == 1000
2 changes: 1 addition & 1 deletion src/PIL/PngImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def save_rewind(self):
}

def rewind(self):
self.im_info = self.rewind_state["info"]
self.im_info = self.rewind_state["info"].copy()
self.im_tile = self.rewind_state["tile"]
self._seq_num = self.rewind_state["seq_num"]

Expand Down

0 comments on commit fc67ee2

Please sign in to comment.