Commits

Ben Jackson  committed 1f8b547

Set optimize=True when generating PNG. File sizes still excessive...

  • Participants
  • Parent commits 014b7b6

Comments (0)

Files changed (1)

File imagekit/specs.py

         
     def _get_imgfile(self):
         format = self._img.format or 'JPEG'
-        if format != 'JPEG':
-            imgfile = img_to_fobj(self._img, format)
-        else:
-	    if self._img.mode not in ('RGB', 'L'):
-		self._img = self._img.convert('RGB')
+        if format == 'PNG':
+            imgfile = img_to_fobj(self._img, format,
+                                  optimize=True)
+        elif format == 'JPEG':
+            if self._img.mode not in ('RGB', 'L'):
+                self._img = self._img.convert('RGB')
             imgfile = img_to_fobj(self._img, format,
                                   quality=int(self.spec.quality),
                                   optimize=True)
+        else:
+            imgfile = img_to_fobj(self._img, format)
         return imgfile
         
     def _create(self):