google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

"Quality" setting is not applied in some cases #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In models.py (version 2.0) in line 409 im.format is None if cropping was
appled before. So format need to be saved before cropping, like this:

--- models.py   2008-09-04 12:09:24.000000000 +0400
+++ models_fixed.py 2008-11-28 04:16:48.000000000 +0300
@@ -387,6 +387,8 @@
             im = Image.open(self.image.path)
         except IOError:
             return
+
+        im_format = im.format
         # Apply effect if found
         if self.effect is not None:
             im = self.effect.pre_process(im)
@@ -406,7 +408,7 @@
         # Save file
         im_filename = getattr(self, "get_%s_filename" % photosize.name)()
         try:
-            if im.format == 'JPEG':
+            if im_format == 'JPEG':
                 im.save(im_filename, 'JPEG',
quality=int(photosize.quality), optimize=True)
             else:
                 im.save(im_filename)

Original issue reported on code.google.com by etes...@gmail.com on 28 Nov 2008 at 1:21

GoogleCodeExporter commented 9 years ago
Nice catch. This is fixed in r356. Thanks!

Original comment by justin.d...@gmail.com on 23 Dec 2008 at 1:40