Simplified code

This commit is contained in:
Andrew Murray 2021-03-06 21:44:31 +11:00
parent 1d7cbeb338
commit 8206f14419

View File

@ -2396,18 +2396,11 @@ class Image:
:returns: An :py:class:`~PIL.Image.Image` object. :returns: An :py:class:`~PIL.Image.Image` object.
""" """
if self.mode == "LA": if self.mode in ("LA", "RGBA"):
return ( return (
self.convert("La") self.convert(self.mode.replace("A", "a"))
.transform(size, method, data, resample, fill, fillcolor) .transform(size, method, data, resample, fill, fillcolor)
.convert("LA") .convert(self.mode)
)
if self.mode == "RGBA":
return (
self.convert("RGBa")
.transform(size, method, data, resample, fill, fillcolor)
.convert("RGBA")
) )
if isinstance(method, ImageTransformHandler): if isinstance(method, ImageTransformHandler):