Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ def verify(self) -> None:
def load(self) -> Image.core.PixelAccess | None:
"""Load image data based on tile list"""

if not self.tile and self._im is None:
msg = "cannot load this image"
raise OSError(msg)

pixel = Image.Image.load(self)
if not self.tile:
return pixel
if self._im is None:
msg = "cannot load this image"
raise OSError(msg)
return Image.Image.load(self)

if self._im is not None:
# If this image has been closed, raise an error
self.im

self.map: mmap.mmap | None = None
use_mmap = self.filename and len(self.tile) == 1
Expand Down
Loading