diff --git a/PIL/Image.py b/PIL/Image.py index d8e230b1652..2eb46a2d563 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -2074,7 +2074,8 @@ def thumbnail(self, size, resample=BICUBIC): # FIXME: the different transform methods need further explanation # 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=None, fillcolor=None): """ Transforms this image. This method creates a new image with the given size, and the same mode as the original, and copies data @@ -2095,7 +2096,7 @@ def transform(self, size, method, data=None, resample=NEAREST, fill=None): environment), or :py:attr:`PIL.Image.BICUBIC` (cubic spline 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`. - :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. :returns: An :py:class:`~PIL.Image.Image` object. """ @@ -2109,7 +2110,6 @@ def transform(self, size, method, data=None, resample=NEAREST, fill=None): size, method, data, resample, fill).convert('RGBA') if isinstance(method, ImageTransformHandler): - fill = 1 return method.transform(size, self, resample=resample, fill=fill) if hasattr(method, "getdata"): @@ -2119,13 +2119,15 @@ def transform(self, size, method, data=None, resample=NEAREST, fill=None): if data is None: raise ValueError("missing method data") - im = new(self.mode, size, fill) + im = new(self.mode, size, fillcolor) if method == MESH: # list of quads 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: - 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