mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Patch : Change from self to image
This commit is contained in:
parent
f19c52b5d5
commit
47ebf695ac
|
@ -178,7 +178,7 @@ def crop(image, border=0):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def scale(self, factor, resample=Image.NEAREST):
|
def scale(image, factor, resample=Image.NEAREST):
|
||||||
"""
|
"""
|
||||||
Returns a rescaled image by a specific factor given in parameter.
|
Returns a rescaled image by a specific factor given in parameter.
|
||||||
A factor greater than 1 expands the image, between 0 and 1 contracts the
|
A factor greater than 1 expands the image, between 0 and 1 contracts the
|
||||||
|
@ -190,13 +190,13 @@ def scale(self, factor, resample=Image.NEAREST):
|
||||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||||
"""
|
"""
|
||||||
if factor == 1:
|
if factor == 1:
|
||||||
return self._new(self.im)
|
return Image.Image._new(image.im)
|
||||||
elif factor <= 0:
|
elif factor <= 0:
|
||||||
raise ValueError("the factor must be greater than 0")
|
raise ValueError("the factor must be greater than 0")
|
||||||
else:
|
else:
|
||||||
size = (int(round(factor * self.width)),
|
size = (int(round(factor * image.width)),
|
||||||
int(round(factor * self.height)))
|
int(round(factor * image.height)))
|
||||||
return self.resize(size, resample)
|
return image.resize(size, resample)
|
||||||
|
|
||||||
|
|
||||||
def deform(image, deformer, resample=Image.BILINEAR):
|
def deform(image, deformer, resample=Image.BILINEAR):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user