Skip to content

Commit 26c4798

Browse files
committed
Revert "Merge pull request python-pillow#7311 from k128/main"
This reverts commit 39d866b, reversing changes made to f39f74f.
1 parent c556c5f commit 26c4798

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Tests/test_file_webp.py

+1
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,5 @@ def test_duration(self, tmp_path):
233233
im.save(out_webp, save_all=True)
234234

235235
with Image.open(out_webp) as reloaded:
236+
reloaded.load()
236237
assert reloaded.info["duration"] == 1000

src/PIL/WebPImagePlugin.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ def _open(self):
7474
self.info["background"] = (bg_r, bg_g, bg_b, bg_a)
7575
self.n_frames = frame_count
7676
self.is_animated = self.n_frames > 1
77-
ret = self._decoder.get_next()
78-
if ret is not None:
79-
self.info["duration"] = ret[1]
8077
self._mode = "RGB" if mode == "RGBX" else mode
8178
self.rawmode = mode
8279
self.tile = []
@@ -93,7 +90,7 @@ def _open(self):
9390
self.info["xmp"] = xmp
9491

9592
# Initialize seek state
96-
self._reset()
93+
self._reset(reset=False)
9794

9895
def _getexif(self):
9996
if "exif" not in self.info:
@@ -116,8 +113,9 @@ def seek(self, frame):
116113
# Set logical frame to requested position
117114
self.__logical_frame = frame
118115

119-
def _reset(self):
120-
self._decoder.reset()
116+
def _reset(self, reset=True):
117+
if reset:
118+
self._decoder.reset()
121119
self.__physical_frame = 0
122120
self.__loaded = -1
123121
self.__timestamp = 0

0 commit comments

Comments
 (0)