mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 13:46:57 +03:00
Merge pull request #8392 from radarhere/tiff_seek
Do not create core image in TIFF seek()
This commit is contained in:
commit
686b5e2cb4
|
@ -1193,11 +1193,11 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
if not self._seek_check(frame):
|
||||
return
|
||||
self._seek(frame)
|
||||
# Create a new core image object on second and
|
||||
# subsequent frames in the image. Image may be
|
||||
# different size/mode.
|
||||
Image._decompression_bomb_check(self._tile_size)
|
||||
self.im = Image.core.new(self.mode, self._tile_size)
|
||||
if self._im is not None and (
|
||||
self.im.size != self._tile_size or self.im.mode != self.mode
|
||||
):
|
||||
# The core image will no longer be used
|
||||
self._im = None
|
||||
|
||||
def _seek(self, frame: int) -> None:
|
||||
self.fp = self._fp
|
||||
|
@ -1279,6 +1279,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
|
||||
def load_prepare(self) -> None:
|
||||
if self._im is None:
|
||||
Image._decompression_bomb_check(self._tile_size)
|
||||
self.im = Image.core.new(self.mode, self._tile_size)
|
||||
ImageFile.ImageFile.load_prepare(self)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user