1 2 3 4 5 6 7 8 9 10 11 | from PIL import ImageEnhance
def _sharpen(image, sharpness=1.6):
"""
Returns a sharpened copy of an image.
Resizing down or thumbnailing your images with PIL.Image tends to make them blurry. I apply this snippet to such images in order to regain some sharpness.
"""
sharpener = ImageEnhance.Sharpness(image)
sharpened_image = sharpener.enhance(sharpness)
return sharpened_image
|
More like this
- Yet Another Image Resizer by stephen_mcd 3 years, 2 months ago
- Resize image on save by David 5 years, 1 month ago
- Unsharp Mask with PIL and PythonMagick by VidJa 4 years, 4 months ago
- ResizeImageField by wim 2 years, 7 months ago
- Async PIL resize of images by FarmKing 1 year, 3 months ago
Comments