mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 19:40:21 +01:00
* Added condition for no scale image, where image have smaller
dimensions than thumbnail.
This commit is contained in:
@@ -142,13 +142,15 @@ class Thumbnail(object):
|
|||||||
img = "%s.%s" %(h[2:], 'jpg')
|
img = "%s.%s" %(h[2:], 'jpg')
|
||||||
return(path.join(t, fpath, img))
|
return(path.join(t, fpath, img))
|
||||||
|
|
||||||
def __scale_image(self, factor=True):
|
def __scale_image(self):
|
||||||
"""create thumbnail. returns image object or None"""
|
"""create thumbnail. returns image object or None"""
|
||||||
try:
|
try:
|
||||||
im = Image.open(self.filename).convert('RGB')
|
im = Image.open(self.filename).convert('RGB')
|
||||||
except:
|
except:
|
||||||
return None
|
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
|
return im
|
||||||
|
|
||||||
def __scale_image_deprecated(self, factor=True):
|
def __scale_image_deprecated(self, factor=True):
|
||||||
|
|||||||
Reference in New Issue
Block a user