From 255a090e9777bf6323d216734c0e8ec08526d022 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 10 Sep 2014 10:41:46 +1000 Subject: [PATCH] Avoid resize operation if image is already the correct size --- PIL/Image.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PIL/Image.py b/PIL/Image.py index 5e1416a33..cd1e450ee 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -1514,6 +1514,9 @@ class Image: self.load() + if self.size == size: + return self._new(self.im) + if self.mode in ("1", "P"): resample = NEAREST