From 233422eefde6eb182e388fc33e0ed46d9ff9246d Mon Sep 17 00:00:00 2001 From: PLHW Date: Fri, 26 Feb 2010 12:49:04 -0800 Subject: [PATCH] adding default quality param to create_thumbnail Signed-off-by: Jannis Leidel --- avatar/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avatar/models.py b/avatar/models.py index af74908..9b0d412 100644 --- a/avatar/models.py +++ b/avatar/models.py @@ -82,7 +82,7 @@ class Avatar(models.Model): def thumbnail_exists(self, size): return self.avatar.storage.exists(self.avatar_name(size)) - def create_thumbnail(self, size): + def create_thumbnail(self, size, quality=95): try: orig = self.avatar.storage.open(self.avatar.name, 'rb').read() image = Image.open(StringIO(orig)) @@ -100,7 +100,7 @@ class Avatar(models.Model): if image.mode != "RGB": image = image.convert("RGB") thumb = StringIO() - image.save(thumb, AVATAR_THUMB_FORMAT) + image.save(thumb, AVATAR_THUMB_FORMAT, quality=quality) thumb_file = ContentFile(thumb.getvalue()) else: thumb_file = ContentFile(orig)