From d8ef314205ff65e6aeeefe3092414cc45e7349eb Mon Sep 17 00:00:00 2001 From: Aleksandr Karpinskii Date: Mon, 16 Sep 2024 10:39:14 +0200 Subject: [PATCH] Remove extra load() calls --- src/PIL/ImageCms.py | 2 -- src/PIL/ImageMath.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index f028f1775..b6c5de5b3 100644 --- a/src/PIL/ImageCms.py +++ b/src/PIL/ImageCms.py @@ -349,7 +349,6 @@ class ImageCmsTransform(Image.ImagePointHandler): return self.apply(im) def apply(self, im: Image.Image, imOut: Image.Image | None = None) -> Image.Image: - im.load() if imOut is None: imOut = Image.new(self.output_mode, im.size, None) self.transform.apply(im.getim(), imOut.getim()) @@ -357,7 +356,6 @@ class ImageCmsTransform(Image.ImagePointHandler): return imOut def apply_in_place(self, im: Image.Image) -> Image.Image: - im.load() if im.mode != self.output_mode: msg = "mode mismatch" raise ValueError(msg) # wrong output mode diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index ff3014a8d..773147b53 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -59,7 +59,6 @@ class _Operand: if im2 is None: # unary operation out = Image.new(mode or im_1.mode, im_1.size, None) - im_1.load() try: op = getattr(_imagingmath, f"{op}_{im_1.mode}") except AttributeError as e: @@ -86,7 +85,6 @@ class _Operand: if im_2.size != size: im_2 = im_2.crop((0, 0) + size) out = Image.new(mode or im_1.mode, im_1.size, None) - im_1.load() try: op = getattr(_imagingmath, f"{op}_{im_1.mode}") except AttributeError as e: