git » galala » commit a71154c

Improve the image resizing parameters

author Alberto Bertogli
2015-06-21 17:50:29 UTC
committer Alberto Bertogli
2015-06-21 18:01:13 UTC
parent 14854b73537863255e7cf71a2936c3e631686bd9

Improve the image resizing parameters

This patch makes PIL use a better algorithm for resizing images, and set the
jpeg quality to 95 which is a reasonable compromise between quality and space
for our use case.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

galala +2 -2

diff --git a/galala b/galala
index b6a5a52..24d4473 100755
--- a/galala
+++ b/galala
@@ -39,8 +39,8 @@ def resize_img(img, x, y, dst):
                 img = img.rotate(exif_rotations[v],
                         expand = True)
 
-    img.thumbnail((x, y))
-    img.save(dst)
+    img.thumbnail((x, y), pil_image.ANTIALIAS)
+    img.save(dst, 'JPEG', quality = 95)
 
 def generate(page_path, dst_path):
     # write the index