Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed load_prepare nearly identical to ImageFile load_prepare #6116

Merged
merged 1 commit into from Mar 10, 2022

Conversation

radarhere
Copy link
Member

def load_prepare(self):
# create image memory if necessary
if not self.im or self.im.mode != self.mode or self.im.size != self.size:
self.im = Image.core.fill(self.mode, self.size, 0)
# create palette (optional)
if self.mode == "P":
Image.Image.load(self)

is nearly identical to its super method

Pillow/src/PIL/ImageFile.py

Lines 280 to 286 in 397a940

def load_prepare(self):
# create image memory if necessary
if not self.im or self.im.mode != self.mode or self.im.size != self.size:
self.im = Image.core.new(self.mode, self.size)
# create palette (optional)
if self.mode == "P":
Image.Image.load(self)

And the differences don't lead to any changes.

>>> from PIL import Image
>>> im = Image.core.fill("RGB", (1, 1), 0)
>>> Image.Image()._new(im).load()[0, 0]
(0, 0, 0)
>>> im = Image.core.new("RGB", (1, 1))
>>> Image.Image()._new(im).load()[0, 0]
(0, 0, 0)

@hugovk hugovk merged commit 0639609 into python-pillow:main Mar 10, 2022
@radarhere radarhere deleted the load_prepare branch March 10, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants