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)