mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-14 15:22:13 +03:00
Simplified code
This commit is contained in:
parent
38b9941d2d
commit
10dfa63f54
|
@ -77,12 +77,10 @@ class AvifImageFile(ImageFile.ImageFile):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get info from decoder
|
# Get info from decoder
|
||||||
self._size, n_frames, mode, icc, exif, exif_orientation, xmp = (
|
self._size, self.n_frames, self._mode, icc, exif, exif_orientation, xmp = (
|
||||||
self._decoder.get_info()
|
self._decoder.get_info()
|
||||||
)
|
)
|
||||||
self.n_frames = n_frames
|
|
||||||
self.is_animated = self.n_frames > 1
|
self.is_animated = self.n_frames > 1
|
||||||
self._mode = mode
|
|
||||||
|
|
||||||
if icc:
|
if icc:
|
||||||
self.info["icc_profile"] = icc
|
self.info["icc_profile"] = icc
|
||||||
|
@ -107,19 +105,19 @@ class AvifImageFile(ImageFile.ImageFile):
|
||||||
if not self._seek_check(frame):
|
if not self._seek_check(frame):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Set tile
|
||||||
self.__frame = frame
|
self.__frame = frame
|
||||||
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.mode)]
|
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.mode)]
|
||||||
|
|
||||||
def load(self) -> Image.core.PixelAccess | None:
|
def load(self) -> Image.core.PixelAccess | None:
|
||||||
if self.tile:
|
if self.tile:
|
||||||
# We need to load the image data for this frame
|
# We need to load the image data for this frame
|
||||||
data, timescale, pts_in_timescales, dur_in_timescales = (
|
data, timescale, pts_in_timescales, duration_in_timescales = (
|
||||||
self._decoder.get_frame(self.__frame)
|
self._decoder.get_frame(self.__frame)
|
||||||
)
|
)
|
||||||
self.info["timestamp"] = round(1000 * (pts_in_timescales / timescale))
|
self.info["timestamp"] = round(1000 * (pts_in_timescales / timescale))
|
||||||
self.info["duration"] = round(1000 * (dur_in_timescales / timescale))
|
self.info["duration"] = round(1000 * (duration_in_timescales / timescale))
|
||||||
|
|
||||||
# Set tile
|
|
||||||
if self.fp and self._exclusive_fp:
|
if self.fp and self._exclusive_fp:
|
||||||
self.fp.close()
|
self.fp.close()
|
||||||
self.fp = BytesIO(data)
|
self.fp = BytesIO(data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user