Updated thumbnails sharpen filter
authorThierry Florac <thierry.florac@onf.fr>
Mon, 19 Nov 2018 14:50:38 +0100
changeset 155 ea055b7b9ae8
parent 154 a94912ae1695
child 156 fa048337f372
Updated thumbnails sharpen filter
src/pyams_file/image.py
--- a/src/pyams_file/image.py	Mon Nov 19 13:24:44 2018 +0100
+++ b/src/pyams_file/image.py	Mon Nov 19 14:50:38 2018 +0100
@@ -89,7 +89,7 @@
         # generate thumbnail
         new_image = BytesIO()
         image.resize((width, height), Image.ANTIALIAS) \
-             .filter(ImageFilter.SHARPEN) \
+             .filter(ImageFilter.UnsharpMask(radius=0.5, percent=100, threshold=0)) \
              .save(new_image, format)
         return new_image, format.lower()
 
@@ -136,7 +136,7 @@
         thumb_size = self.get_thumb_size(width, height, geometry)
         image.crop((geometry.x1, geometry.y1, geometry.x2, geometry.y2)) \
              .resize(thumb_size, Image.ANTIALIAS) \
-             .filter(ImageFilter.SHARPEN) \
+             .filter(ImageFilter.UnsharpMask(radius=0.5, percent=100, threshold=0)) \
              .save(new_image, format)
         return new_image, format.lower()