From b568220ae42825529b7a206a4ec8ce0bf0917e85 Mon Sep 17 00:00:00 2001 From: thodnev Date: Thu, 25 Aug 2016 03:14:42 +0300 Subject: [PATCH] Update Image.py --- PIL/Image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PIL/Image.py b/PIL/Image.py index 851ef0b9c..c3e417520 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -1790,8 +1790,8 @@ class Image(object): # preserve aspect ratio x, y = self.size if x > size[0] or y > size[1]: - factor = max(x/size[0], y/size[1]) - x, y = int(x/factor), int(y/factor) + factor = min(float(size[0])/x, float(size[1])/y) + x, y = int(x*factor), int(y*factor) size = x, y self.draft(None, size)