From 8206f14419873c7186ba7b9028d9d5189bce385b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 6 Mar 2021 21:44:31 +1100 Subject: [PATCH] Simplified code --- src/PIL/Image.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 01fe7ed1b..cc1c23fdb 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2396,18 +2396,11 @@ class Image: :returns: An :py:class:`~PIL.Image.Image` object. """ - if self.mode == "LA": + if self.mode in ("LA", "RGBA"): return ( - self.convert("La") + self.convert(self.mode.replace("A", "a")) .transform(size, method, data, resample, fill, fillcolor) - .convert("LA") - ) - - if self.mode == "RGBA": - return ( - self.convert("RGBa") - .transform(size, method, data, resample, fill, fillcolor) - .convert("RGBA") + .convert(self.mode) ) if isinstance(method, ImageTransformHandler):