From a07bac3a56518e40559e3b14619ccd0c89a01e50 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 21 Nov 2023 21:45:14 +1100 Subject: [PATCH] Attempt memory mapping when tile args is a string --- src/PIL/ImageFile.py | 2 ++ src/PIL/WebPImagePlugin.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index 902e8ce5f..998a68e1c 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -187,6 +187,8 @@ class ImageFile(Image.Image): if use_mmap: # try memory mapping decoder_name, extents, offset, args = self.tile[0] + if isinstance(args, str): + args = (args, 0, 1) if ( decoder_name == "raw" and len(args) >= 3 diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py index 612fc0946..eed58a13b 100644 --- a/src/PIL/WebPImagePlugin.py +++ b/src/PIL/WebPImagePlugin.py @@ -168,6 +168,9 @@ class WebPImageFile(ImageFile.ImageFile): return super().load() + def load_seek(self, pos): + pass + def tell(self): if not _webp.HAVE_WEBPANIM: return super().tell()