1
0
mirror of https://github.com/gryf/pygtktalog.git synced 2025-12-17 11:30:19 +01:00

* Added condition for no scale image, where image have smaller

dimensions than thumbnail.
This commit is contained in:
2008-05-19 14:12:04 +00:00
parent 400cc5ab4f
commit f44f80874d

View File

@@ -142,12 +142,14 @@ 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
x, y = im.size
if x > self.x or y > self.y:
im.thumbnail((self.x, self.y), Image.ANTIALIAS)
return im