Sharpening images

 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

Comments

(Forgotten your password?)

You may use Markdown syntax here, but raw HTML will be removed.