Update WebPImagePlugin.py

Automatically load duration
This commit is contained in:
k128 2023-07-31 15:14:22 -04:00 committed by GitHub
parent c1c474a1f2
commit 27a0339d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,6 +74,9 @@ class WebPImageFile(ImageFile.ImageFile):
self.info["background"] = (bg_r, bg_g, bg_b, bg_a) self.info["background"] = (bg_r, bg_g, bg_b, bg_a)
self.n_frames = frame_count self.n_frames = frame_count
self.is_animated = self.n_frames > 1 self.is_animated = self.n_frames > 1
_,ts=self._decoder.get_next()
if ts:
self.info["duration"]=ts
self._mode = "RGB" if mode == "RGBX" else mode self._mode = "RGB" if mode == "RGBX" else mode
self.rawmode = mode self.rawmode = mode
self.tile = [] self.tile = []