From f44f80874d05ae09916da0d71a0405a0d7b3001c Mon Sep 17 00:00:00 2001 From: gryf Date: Mon, 19 May 2008 14:12:04 +0000 Subject: [PATCH] * Added condition for no scale image, where image have smaller dimensions than thumbnail. --- src/utils/thumbnail.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/thumbnail.py b/src/utils/thumbnail.py index 27ce8df..28e6ad5 100644 --- a/src/utils/thumbnail.py +++ b/src/utils/thumbnail.py @@ -142,13 +142,15 @@ class Thumbnail(object): img = "%s.%s" %(h[2:], 'jpg') return(path.join(t, fpath, img)) - def __scale_image(self, factor=True): + def __scale_image(self): """create thumbnail. returns image object or None""" try: im = Image.open(self.filename).convert('RGB') except: return None - im.thumbnail((self.x, self.y), Image.ANTIALIAS) + x, y = im.size + if x > self.x or y > self.y: + im.thumbnail((self.x, self.y), Image.ANTIALIAS) return im def __scale_image_deprecated(self, factor=True):