Do not create core image in TIFF seek() by radarhere · Pull Request #8392 · python-pillow/Pillow
Conversation
| def seek(self, frame: int) -> None: | |
| """Select a given frame as current image""" | |
| 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) |
The core image instance does not need to be created here. It can be set to None instead, and the initialisation can delayed until load() (or more specifically, load_prepare()).
| def load_prepare(self) -> None: | |
| if self._im is None: | |
| self.im = Image.core.new(self.mode, self._tile_size) |
radarhere
changed the title
Do not create core image in TiffImagePlugin seek(), when load() might not run
Do not create core image in TIFF seek(), when load() might not run
radarhere
changed the title
Do not create core image in TIFF seek(), when load() might not run
Do not create core image in TIFF seek()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters