mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-26 16:50:33 +03:00
Use different parameter than the existing interface
This commit is contained in:
parent
dce04b680b
commit
68b960ca2f
14
PIL/Image.py
14
PIL/Image.py
|
@ -2074,7 +2074,8 @@ class Image(object):
|
||||||
|
|
||||||
# FIXME: the different transform methods need further explanation
|
# FIXME: the different transform methods need further explanation
|
||||||
# instead of bloating the method docs, add a separate chapter.
|
# instead of bloating the method docs, add a separate chapter.
|
||||||
def transform(self, size, method, data=None, resample=NEAREST, fill=None):
|
def transform(self, size, method, data=None, resample=NEAREST,
|
||||||
|
fill=1, fillcolor=None):
|
||||||
"""
|
"""
|
||||||
Transforms this image. This method creates a new image with the
|
Transforms this image. This method creates a new image with the
|
||||||
given size, and the same mode as the original, and copies data
|
given size, and the same mode as the original, and copies data
|
||||||
|
@ -2095,7 +2096,7 @@ class Image(object):
|
||||||
environment), or :py:attr:`PIL.Image.BICUBIC` (cubic spline
|
environment), or :py:attr:`PIL.Image.BICUBIC` (cubic spline
|
||||||
interpolation in a 4x4 environment). If omitted, or if the image
|
interpolation in a 4x4 environment). If omitted, or if the image
|
||||||
has mode "1" or "P", it is set to :py:attr:`PIL.Image.NEAREST`.
|
has mode "1" or "P", it is set to :py:attr:`PIL.Image.NEAREST`.
|
||||||
:param fill: Optional fill color for the area outside the transform
|
:param fillcolor: Optional fill color for the area outside the transform
|
||||||
in the output image.
|
in the output image.
|
||||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||||
"""
|
"""
|
||||||
|
@ -2109,7 +2110,6 @@ class Image(object):
|
||||||
size, method, data, resample, fill).convert('RGBA')
|
size, method, data, resample, fill).convert('RGBA')
|
||||||
|
|
||||||
if isinstance(method, ImageTransformHandler):
|
if isinstance(method, ImageTransformHandler):
|
||||||
fill = 1
|
|
||||||
return method.transform(size, self, resample=resample, fill=fill)
|
return method.transform(size, self, resample=resample, fill=fill)
|
||||||
|
|
||||||
if hasattr(method, "getdata"):
|
if hasattr(method, "getdata"):
|
||||||
|
@ -2119,13 +2119,15 @@ class Image(object):
|
||||||
if data is None:
|
if data is None:
|
||||||
raise ValueError("missing method data")
|
raise ValueError("missing method data")
|
||||||
|
|
||||||
im = new(self.mode, size, fill)
|
im = new(self.mode, size, fillcolor)
|
||||||
if method == MESH:
|
if method == MESH:
|
||||||
# list of quads
|
# list of quads
|
||||||
for box, quad in data:
|
for box, quad in data:
|
||||||
im.__transformer(box, self, QUAD, quad, resample, fill is None)
|
im.__transformer(box, self, QUAD, quad, resample,
|
||||||
|
fillcolor is None)
|
||||||
else:
|
else:
|
||||||
im.__transformer((0, 0)+size, self, method, data, resample, fill is None)
|
im.__transformer((0, 0)+size, self, method, data,
|
||||||
|
resample, fillcolor is None)
|
||||||
|
|
||||||
return im
|
return im
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user