Skip to content

Commit

Permalink
Remove extra load() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
homm committed Sep 16, 2024
1 parent 3b09f43 commit d8ef314
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/PIL/ImageCms.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,13 @@ def point(self, im: Image.Image) -> Image.Image:
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())
imOut.info["icc_profile"] = self.output_profile.tobytes()
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
Expand Down
2 changes: 0 additions & 2 deletions src/PIL/ImageMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def apply(
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:
Expand All @@ -86,7 +85,6 @@ def apply(
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:
Expand Down

0 comments on commit d8ef314

Please sign in to comment.