Remove extra load() calls

This commit is contained in:
Aleksandr Karpinskii 2024-09-16 10:39:14 +02:00
parent 3b09f436bd
commit d8ef314205
2 changed files with 0 additions and 4 deletions

View File

@ -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

View File

@ -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: